Skip to content

Commit

Permalink
feat: add getOptions method (resolves: #215)
Browse files Browse the repository at this point in the history
  • Loading branch information
pimlie authored and manniL committed Mar 12, 2019
1 parent 3db250d commit 31e975d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/client/$meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export default function _$meta(options = {}) {
*/
return function $meta() {
return {
getOptions: () => Object.freeze({ ...options }),
refresh: _refresh.bind(this),
inject,
pause: pause.bind(this),
Expand Down
1 change: 1 addition & 0 deletions src/server/$meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default function _$meta(options = {}) {
*/
return function $meta() {
return {
getOptions: () => Object.freeze({ ...options }),
refresh: _refresh.bind(this),
inject: _inject.bind(this),
pause: pause.bind(this),
Expand Down
5 changes: 5 additions & 0 deletions test/plugin-browser.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,14 @@ describe('plugin', () => {

expect(instance.$meta().inject).toEqual(expect.any(Function))
expect(instance.$meta().refresh).toEqual(expect.any(Function))
expect(instance.$meta().getOptions).toEqual(expect.any(Function))

expect(instance.$meta().inject()).toBeUndefined()
expect(instance.$meta().refresh()).toBeDefined()

const options = instance.$meta().getOptions()
expect(options).toBeDefined()
expect(options.keyName).toBe(defaultOptions.keyName)
})

test('component has _hasMetaInfo set to true', () => {
Expand Down

0 comments on commit 31e975d

Please sign in to comment.