Skip to content

Commit 79a13d0

Browse files
committed
Asyncify test
1 parent a0a9280 commit 79a13d0

File tree

4 files changed

+55
-55
lines changed

4 files changed

+55
-55
lines changed

tests/insecure_login.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ if (Meteor.isServer) {
5353
});
5454
}
5555

56-
Accounts.registerLoginHandler((options) => {
56+
Accounts.registerLoginHandler(async (options) => {
5757
if (!options.username) return;
5858

59-
var user = Meteor.users.findOne({
59+
var user = await Meteor.users.findOneAsync({
6060
'username': options.username
6161
});
6262
if (!user) return;

tests/server_tests.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,20 @@ Meteor.publish(null, () => Meteor.users.find({}, {
1919
}));
2020

2121
Meteor.methods({
22-
'grabStatus'() {
23-
return Meteor.users.find({
22+
async 'grabStatus'() {
23+
return await Meteor.users.find({
2424
_id: {
2525
$ne: TEST_userId
2626
}
2727
}, {
2828
fields: {
2929
status: 1
3030
}
31-
}).fetch();
31+
}).fetchAsync();
3232
},
33-
'grabSessions'() {
33+
async 'grabSessions'() {
3434
// Only grab sessions not generated by server-side tests.
35-
return UserStatus.connections.find({
35+
return await UserStatus.connections.find({
3636
$and: [{
3737
userId: {
3838
$ne: TEST_userId
@@ -44,6 +44,6 @@ Meteor.methods({
4444
}
4545
}
4646
]
47-
}).fetch();
47+
}).fetchAsync();
4848
}
4949
});

tests/setup.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ export let TEST_userId = '';
66
export const TEST_IP = '255.255.255.0';
77

88
if (Meteor.isServer) {
9-
const testUserExists = Meteor.users.findOne({
9+
const testUserExists = await Meteor.users.findOneAsync({
1010
username: TEST_username
1111
});
1212

1313
if (!testUserExists) {
14-
TEST_userId = Meteor.users.insert({
14+
TEST_userId = await Meteor.users.insertAsync({
1515
username: TEST_username
1616
});
1717
console.log('Inserted test user id: ', TEST_userId);

0 commit comments

Comments
 (0)