Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reversing #177 & additional tests #182

Merged
merged 3 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .npm/package/npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,16 @@ This package is great for publishing small sets of related documents. If you use

You will not be able to access `this.userId` inside your `find` functions if you use [arrow functions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions).

## Testing

Run the following:
```shell
meteor test-packages reywood:publish-composite --driver-package meteortesting:mocha
```
The tests are executing a combination of methods and subscriptions. The quickest option was to add a pause after each
operation (see usage of `sleep()` in `./tests/server.js`), to allow for the publications to send down all the
documents. However, this is flaky, so you may want to refresh the browser if you notice tests failing for no
apparent reason.

## Reporting issues/bugs

Expand Down
3 changes: 1 addition & 2 deletions lib/subscription.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ class Subscription {
added (collectionName, doc) {
this.refCounter.increment(collectionName, doc._id)

const existingDoc = this.docHash[buildHashKey(collectionName, doc.id)]
if (!existingDoc) {
if (this._hasDocChanged(collectionName, doc._id, doc)) {
debugLog('Subscription.added', `${collectionName}:${doc._id}`)
this.meteorSub.added(collectionName, doc._id, doc)
this._addDocHash(collectionName, doc)
Expand Down
2 changes: 0 additions & 2 deletions package.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ Package.onUse((api) => {
// meteor test-packages reywood:publish-composite --driver-package meteortesting:mocha
Package.onTest((api) => {
Npm.depends({
'lodash.isequal': '4.5.0',
'chai-as-promised': '7.1.1',
chai: '4.3.10'
})
api.use([
Expand Down
Loading
Loading