-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
15 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
import config from '../../config'; | ||
import { NotificationKey } from '../../models/NotificationModel'; | ||
import { AccountType } from '../../models/UserModel'; | ||
import { MB } from '../../utils/bytes'; | ||
import { execRequestC } from '../../utils/testing/apiUtils'; | ||
import { beforeAllDb, afterAllTests, beforeEachDb, models } from '../../utils/testing/testUtils'; | ||
import { FormUser } from './signup'; | ||
|
||
describe('index_signup', function() { | ||
|
||
|
@@ -19,12 +21,22 @@ describe('index_signup', function() { | |
}); | ||
|
||
test('should create a new account', async function() { | ||
const context = await execRequestC('', 'POST', 'signup', { | ||
const formUser: FormUser = { | ||
full_name: 'Toto', | ||
email: '[email protected]', | ||
password: 'testing', | ||
password2: 'testing', | ||
}); | ||
}; | ||
|
||
// First confirm that it doesn't work if sign up is disabled | ||
{ | ||
config().signupEnabled = false; | ||
await execRequestC('', 'POST', 'signup', formUser); | ||
expect(await models().user().loadByEmail('[email protected]')).toBeFalsy(); | ||
} | ||
|
||
config().signupEnabled = true; | ||
const context = await execRequestC('', 'POST', 'signup', formUser); | ||
|
||
// Check that the user has been created | ||
const user = await models().user().loadByEmail('[email protected]'); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters