Skip to content

Commit

Permalink
Mocks the server property inside the already mocked session to avoid …
Browse files Browse the repository at this point in the history
…errors with publication strategies
  • Loading branch information
filipenevola committed Sep 30, 2021
1 parent 8af02a1 commit d32314c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ When using the subscache package (`ccorcos:subs-cache` or `blockrazor:subscache-

### No support for publication strategies

This package could affect the behavior of non-default [publication strategies](https://docs.meteor.com/api/pubsub.html#Publication-strategies).
This package could affect the behavior of non-default [publication strategies](https://docs.meteor.com/api/pubsub.html#Publication-strategies).

## Debugging

Expand Down
19 changes: 10 additions & 9 deletions lib/server/publish_context.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,23 @@ import { EJSON } from 'meteor/ejson';
import { Meteor } from 'meteor/meteor';
import { MeteorX } from 'meteor/montiapm:meteorx';

// mock server
const server = {
getPublicationStrategy () {
return {
useCollectionView: true,
doAccountingForCollection: true,
};
},
};

const PublishContext = function PublishContext (
context,
handler,
subscriptionId,
params,
name,
) {
// mock server
const server = {
getPublicationStrategy() {
return {
useCollectionView: true,
doAccountingForCollection: true,
}
}
}
// mock session
const sessionId = Random.id();
const session = {
Expand Down

0 comments on commit d32314c

Please sign in to comment.