In this PR there's a minor fix to the watcher code when pouch config options are null. I think the expected behavior is that if the pouch config options are null for some reason then don't do anything and simply return, no need to check if the key exists on the vue instance since all this is handled in the beforeCreate lifecycle hook. I've added a custom Vue event to emit 'pouchdb-livefeed-error' now and have created a unit test to make sure this behavior occurs.
Added a few more custom vue events to attach to events emitted by the liveFeed object.
Result of unit tests:
PASS tests/testData.spec.js
Pouch options are returned by function
Unit Tests that todos is defined on Vue components
√ Test Plugin with Empty Data Function (16ms)
√ Test Plugin with Empty Data Object (15ms)
√ Test Plugin with No Data Function Or Object
√ Test Plugin with Existing Data Function
Unit Tests to see that the todos property on the data root level is connected with the todos property on the vue instance (this is what the beforeCreate lifecycle hook does)
√ Test Plugin with Empty Data Function
√ Test Plugin with Empty Data Object
√ Test Plugin with No Data Function Or Object
√ Test Plugin with Existing Data Function
Pouch options are objects
Unit Tests that todos is defined on Vue components
√ Test Plugin with Empty Data Function
√ Test Plugin with Empty Data Object
√ Test Plugin with No Data Function Or Object (16ms)
√ Test Plugin with Existing Data Function
Unit Tests to see that the todos property on the data root level is connected with the todos property on the vue instance (this is what the beforeCreate lifecycle hook does)
√ Test Plugin with Empty Data Function
√ Test Plugin with Empty Data Object
√ Test Plugin with No Data Function Or Object
√ Test Plugin with Existing Data Function
Set selector to null
√ Test Plugin with Reactive Selector that can return null
Another PR! Thanks for approving the last one.
In this PR there's a minor fix to the watcher code when pouch config options are null. I think the expected behavior is that if the pouch config options are null for some reason then don't do anything and simply return, no need to check if the key exists on the vue instance since all this is handled in the beforeCreate lifecycle hook. I've added a custom Vue event to emit 'pouchdb-livefeed-error' now and have created a unit test to make sure this behavior occurs.
Added a few more custom vue events to attach to events emitted by the liveFeed object.
Result of unit tests:
Let me know what you think. Thanks!