Skip to content

Commit d32314c

Browse files
committed
Mocks the server property inside the already mocked session to avoid errors with publication strategies
1 parent 8af02a1 commit d32314c

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ When using the subscache package (`ccorcos:subs-cache` or `blockrazor:subscache-
208208

209209
### No support for publication strategies
210210

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

213213
## Debugging
214214

lib/server/publish_context.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,23 @@ import { EJSON } from 'meteor/ejson';
44
import { Meteor } from 'meteor/meteor';
55
import { MeteorX } from 'meteor/montiapm:meteorx';
66

7+
// mock server
8+
const server = {
9+
getPublicationStrategy () {
10+
return {
11+
useCollectionView: true,
12+
doAccountingForCollection: true,
13+
};
14+
},
15+
};
16+
717
const PublishContext = function PublishContext (
818
context,
919
handler,
1020
subscriptionId,
1121
params,
1222
name,
1323
) {
14-
// mock server
15-
const server = {
16-
getPublicationStrategy() {
17-
return {
18-
useCollectionView: true,
19-
doAccountingForCollection: true,
20-
}
21-
}
22-
}
2324
// mock session
2425
const sessionId = Random.id();
2526
const session = {

0 commit comments

Comments
 (0)