Skip to content

Commit

Permalink
Merge pull request #182 from manueltimita/master
Browse files Browse the repository at this point in the history
Reversing #177 & additional tests
  • Loading branch information
StorytellerCZ authored Mar 4, 2024
2 parents cb5b0a3 + 4e81460 commit 1f41d63
Show file tree
Hide file tree
Showing 7 changed files with 248 additions and 116 deletions.
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

0 comments on commit 1f41d63

Please sign in to comment.