mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
tests: passwords - createUser hooks & createUser hooks
This commit is contained in:
@@ -1113,25 +1113,25 @@ if (Meteor.isServer) (() => {
|
||||
});
|
||||
|
||||
|
||||
Tinytest.add('passwords - createUser hooks', test => {
|
||||
const username = Random.id();
|
||||
// should fail the new user validators
|
||||
test.throws(() => Accounts.createUser(
|
||||
{username: username, profile: {invalid: true}}
|
||||
));
|
||||
Tinytest.addAsync('passwords - createUser hooks', async test => {
|
||||
const username = Random.id();
|
||||
// should fail the new user validators
|
||||
await test.throwsAsync(
|
||||
async () =>
|
||||
await Accounts.createUser({ username: username, profile: { invalid: true } }));
|
||||
|
||||
const userId = Accounts.createUser({username: username,
|
||||
testOnCreateUserHook: true});
|
||||
const userId = await Accounts
|
||||
.createUser({ username: username, testOnCreateUserHook: true });
|
||||
|
||||
test.isTrue(userId);
|
||||
const user = Meteor.users.findOne(userId);
|
||||
test.equal(user.profile.touchedByOnCreateUser, true);
|
||||
});
|
||||
test.isTrue(userId);
|
||||
const user = await Meteor.users.findOne(userId);
|
||||
test.equal(user.profile.touchedByOnCreateUser, true);
|
||||
});
|
||||
|
||||
|
||||
Tinytest.add(
|
||||
Tinytest.addAsync(
|
||||
'passwords - setPassword',
|
||||
test => {
|
||||
async test => {
|
||||
const username = Random.id();
|
||||
const email = `${username}-intercept@example.com`;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user