Skip to content

Commit e251183

Browse files
committed
Fix tests
1 parent 26df242 commit e251183

1 file changed

Lines changed: 2 additions & 26 deletions

File tree

packages/server/api/test/unit/authentication/new-user/create-user.test.ts

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,6 @@
11
import { ErrorCode, OrganizationRole, UserStatus } from '@openops/shared';
22
import { QueryFailedError } from 'typeorm';
33

4-
const preSignUpMock = jest.fn();
5-
jest.mock(
6-
'../../../../src/app/authentication/authentication-service/hooks',
7-
() => {
8-
return {
9-
authenticationServiceHooks: {
10-
get: () => ({ preSignUp: preSignUpMock }),
11-
},
12-
};
13-
},
14-
);
15-
164
const createUserServiceMock = jest.fn();
175
const deleteUserServiceMock = jest.fn();
186
jest.mock('../../../../src/app/user/user-service', () => ({
@@ -80,12 +68,6 @@ describe('create-user', () => {
8068

8169
const res = await createUser({ ...baseParams, password: 'P@ssw0rd' });
8270

83-
expect(preSignUpMock).toHaveBeenCalledWith({
84-
name: 'John Doe',
85-
email: baseParams.email,
86-
password: 'P@ssw0rd',
87-
});
88-
8971
expect(createUserServiceMock).toHaveBeenCalledWith({
9072
email: baseParams.email,
9173
organizationRole: OrganizationRole.MEMBER,
@@ -118,7 +100,7 @@ describe('create-user', () => {
118100
);
119101

120102
await expect(
121-
createUser({ ...baseParams, password: 'abc' }),
103+
createUser({ ...baseParams, password: 'abcas2esf' }),
122104
).rejects.toMatchObject({
123105
error: {
124106
code: ErrorCode.EXISTING_USER,
@@ -139,7 +121,7 @@ describe('create-user', () => {
139121
createTablesUserMock.mockRejectedValue(new Error('tables down'));
140122

141123
await expect(
142-
createUser({ ...baseParams, password: 'abc' }),
124+
createUser({ ...baseParams, password: 'ab122rwerc' }),
143125
).rejects.toBeInstanceOf(Error);
144126

145127
expect(deleteUserServiceMock).toHaveBeenCalledWith({
@@ -160,12 +142,6 @@ describe('create-user', () => {
160142

161143
const res = await createUserWithRandomPassword(baseParams);
162144

163-
expect(preSignUpMock).toHaveBeenCalledWith({
164-
name: 'John Doe',
165-
email: baseParams.email,
166-
password: 'Rand#123',
167-
});
168-
169145
expect(createUserServiceMock).toHaveBeenCalledWith(
170146
expect.objectContaining({ password: 'Rand#123' }),
171147
);

0 commit comments

Comments
 (0)