Skip to content

Commit

Permalink
fix: generate separate user credentials for each test
Browse files Browse the repository at this point in the history
because second signup with same credentials was causing "This email address is already registered on whyd"
  • Loading branch information
adrienjoly committed Dec 1, 2019
1 parent 58a183a commit bfd06b3
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions test/api/auth.api.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,20 +81,23 @@ describe('auth api', () => {
});

describe('signup with secure hash', () => {
const secureUser = {
name: 'secure user',
email: 'secure-user@openwhyd.org',
password: 'mySecurePassword'
};
const genSecureUser = (() => {
let globalNumber = 0;
return (number = ++globalNumber) => ({
name: `secure user ${number}`,
email: `secure-user-${number}@openwhyd.org`,
password: `mySecurePassword${number}`
});
})();

it('can create account', async () => {
const { jar, body } = await signupAs(secureUser);
const { jar, body } = await signupAs(genSecureUser());
assert.ifError(body.error);
});

it.skip('actually create an account and logged in', async () => {
const { jar } = await signupAs(secureUser);
const { body } = await getUser(jar, {});
it('gives access to personal /stream', async () => {
const { jar } = await signupAs(genSecureUser());
const { body } = await get(jar, '/stream?format=json');
assert.ifError(body.error);
});

Expand Down

0 comments on commit bfd06b3

Please sign in to comment.