Skip to content

Commit e48b062

Browse files
committed
Comment out find hooks tests in find_users.test.js and remove find context tests in publish.test.js due to v2.0.0 changes.
1 parent 25177ff commit e48b062

File tree

2 files changed

+61
-60
lines changed

2 files changed

+61
-60
lines changed

tests-app/find_users.test.js

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -6,68 +6,68 @@ import expect from 'expect'
66
// When running in isolation, both tests pass
77
// When running only one, both work, too
88
describe('users - find hooks', function () {
9-
it('should be capable of being used on special Meteor.users collection', async function () {
9+
// it('should be capable of being used on special Meteor.users collection', async function () {
1010

11-
const aspect1 = Meteor.users.before.find(function (userId, selector, options) {
12-
if (selector && selector.test) {
13-
selector.a = 1
14-
}
15-
})
11+
// const aspect1 = Meteor.users.before.find(function (userId, selector, options) {
12+
// if (selector && selector.test) {
13+
// selector.a = 1
14+
// }
15+
// })
1616

17-
const aspect2 = Meteor.users.after.find(function (userId, selector, options) {
18-
if (selector && selector.test) {
19-
selector.b = 1
20-
}
21-
})
17+
// const aspect2 = Meteor.users.after.find(function (userId, selector, options) {
18+
// if (selector && selector.test) {
19+
// selector.b = 1
20+
// }
21+
// })
2222

23-
const selector = { test: 1 }
23+
// const selector = { test: 1 }
2424

25-
const cursor = Meteor.users.find(selector)
25+
// const cursor = Meteor.users.find(selector)
2626

27-
expect(Object.prototype.hasOwnProperty.call(selector, 'a')).toBe(true)
28-
expect(Object.prototype.hasOwnProperty.call(selector, 'b')).toBe(true)
29-
aspect1.remove()
30-
aspect2.remove()
27+
// expect(Object.prototype.hasOwnProperty.call(selector, 'a')).toBe(true)
28+
// expect(Object.prototype.hasOwnProperty.call(selector, 'b')).toBe(true)
29+
// aspect1.remove()
30+
// aspect2.remove()
3131

32-
})
32+
// })
3333

34-
it('should be capable of being used on wrapped Meteor.users collection', async function () {
35-
function TestUser (doc) {
36-
return Object.assign(this, doc)
37-
}
34+
// it('should be capable of being used on wrapped Meteor.users collection', async function () {
35+
// function TestUser (doc) {
36+
// return Object.assign(this, doc)
37+
// }
3838

39-
Meteor.users.__transform = doc => new TestUser(doc)
39+
// Meteor.users.__transform = doc => new TestUser(doc)
4040

41-
const MeteorUsersFind = Meteor.users.find
41+
// const MeteorUsersFind = Meteor.users.find
4242

43-
Meteor.users.find = function (selector = {}, options = {}) {
44-
return MeteorUsersFind.call(this, selector, { transform: Meteor.users.__transform, ...options })
45-
}
43+
// Meteor.users.find = function (selector = {}, options = {}) {
44+
// return MeteorUsersFind.call(this, selector, { transform: Meteor.users.__transform, ...options })
45+
// }
4646

47-
// eslint-disable-next-line array-callback-return
48-
const aspect1 = Meteor.users.before.find(function (userId, selector, options) {
49-
if (selector && selector.test) {
50-
selector.a = 1
51-
}
52-
})
47+
// // eslint-disable-next-line array-callback-return
48+
// const aspect1 = Meteor.users.before.find(function (userId, selector, options) {
49+
// if (selector && selector.test) {
50+
// selector.a = 1
51+
// }
52+
// })
5353

54-
// eslint-disable-next-line array-callback-return
55-
const aspect2 = Meteor.users.after.find(function (userId, selector, options) {
56-
if (selector && selector.test) {
57-
selector.b = 1
58-
}
59-
})
54+
// // eslint-disable-next-line array-callback-return
55+
// const aspect2 = Meteor.users.after.find(function (userId, selector, options) {
56+
// if (selector && selector.test) {
57+
// selector.b = 1
58+
// }
59+
// })
6060

61-
const selector = { test: 1 }
62-
Meteor.users.find(selector)
63-
expect(Object.prototype.hasOwnProperty.call(selector, 'a')).toBe(true)
64-
expect(Object.prototype.hasOwnProperty.call(selector, 'b')).toBe(true)
65-
aspect1.remove()
66-
aspect2.remove()
61+
// const selector = { test: 1 }
62+
// Meteor.users.find(selector)
63+
// expect(Object.prototype.hasOwnProperty.call(selector, 'a')).toBe(true)
64+
// expect(Object.prototype.hasOwnProperty.call(selector, 'b')).toBe(true)
65+
// aspect1.remove()
66+
// aspect2.remove()
6767

68-
// Remove this line - it's not testing hook functionality
69-
// expect(await Meteor.users.find().countAsync()).not.toBe(0)
68+
// // Remove this line - it's not testing hook functionality
69+
// // expect(await Meteor.users.find().countAsync()).not.toBe(0)
7070

71-
Meteor.users.find = MeteorUsersFind
72-
})
71+
// Meteor.users.find = MeteorUsersFind
72+
// })
7373
})

tests-app/server/publish.test.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -114,17 +114,18 @@ if (Meteor.isServer) {
114114
})
115115
})
116116

117-
describe('find - server side within publish context', function () {
118-
it('userId available to before find hook when within publish context', function () {
119-
expect(beforeFindUserId).not.toBe(null)
120-
expect(beforeFindWithinPublish).toBe(true)
121-
})
122-
123-
it('userId available to after find hook when within publish context', function () {
124-
expect(afterFindUserId).not.toBe(null)
125-
expect(afterFindWithinPublish).toBe(true)
126-
})
127-
})
117+
// v2.0.0 find hooks have been removed, check the history for the changes
118+
// describe('find - server side within publish context', function () {
119+
// it('userId available to before find hook when within publish context', function () {
120+
// expect(beforeFindUserId).not.toBe(null)
121+
// expect(beforeFindWithinPublish).toBe(true)
122+
// })
123+
124+
// it('userId available to after find hook when within publish context', function () {
125+
// expect(afterFindUserId).not.toBe(null)
126+
// expect(afterFindWithinPublish).toBe(true)
127+
// })
128+
// })
128129

129130
describe('findone - server side within publish context', function () {
130131
it('userId available to before findOne hook when within publish context', function () {

0 commit comments

Comments
 (0)