Skip to content

Commit 25271bc

Browse files
author
hirsch88
committed
Improve auth faker
1 parent fa4cbab commit 25271bc

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

test/e2e/api/users.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ describe('/api/users', () => {
2424
beforeAll(async () => synchronizeDatabase(settings.connection));
2525
beforeAll(async () => factory = getFactory(settings.connection));
2626
beforeAll(async () => bruce = await factory.runSeed<User>(CreateBruce));
27-
beforeAll(async () => authServer = fakeAuthenticationForUser(bruce));
27+
beforeAll(async () => authServer = fakeAuthenticationForUser(bruce, true));
2828

2929
// -------------------------------------------------------------------------
3030
// Tear down

test/e2e/utils/auth.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,15 @@ import { User } from '../../../src/api/models/User';
33
import { env } from '../../../src/core/env';
44

55

6-
export const fakeAuthenticationForUser = (user: User): nock.Scope => {
7-
return nock(env.auth.route)
8-
.persist()
6+
export const fakeAuthenticationForUser = (user: User, persist = false): nock.Scope => {
7+
const scope = nock(env.auth.route)
8+
// .persist()
99
.post('')
1010
.reply(200, {
1111
user_id: `auth0|${user.email}`,
1212
});
13+
if (persist) {
14+
scope.persist();
15+
}
16+
return scope;
1317
};

0 commit comments

Comments
 (0)