Skip to content

Commit fbd84b8

Browse files
committed
fix: update tests to the new architecture
1 parent be7d3c8 commit fbd84b8

File tree

39 files changed

+539
-572
lines changed

39 files changed

+539
-572
lines changed

modules/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"start": "tsc --watch",
1010
"precompile": "pnpm run clean",
1111
"compile": "pnpm run generate:graphql && tsc",
12-
"testonly": "jest",
12+
"testonly": "jest --passWithNoTests",
1313
"coverage": "pnpm run testonly -- --coverage",
1414
"generate:graphql": "gql-gen",
1515
"prepublishOnly": "pnpm run compile"

modules/magic-link/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"start": "tsc --watch",
1010
"precompile": "pnpm run clean",
1111
"compile": "pnpm run generate:graphql && tsc",
12-
"testonly": "jest",
12+
"testonly": "jest --passWithNoTests",
1313
"coverage": "pnpm run testonly -- --coverage",
1414
"generate:graphql": "gql-gen",
1515
"prepublishOnly": "pnpm run compile"

modules/mikro-orm/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"start": "tsc --watch",
1010
"precompile": "pnpm run clean",
1111
"compile": "tsc",
12-
"testonly": "jest",
12+
"testonly": "jest --passWithNoTests",
1313
"coverage": "pnpm run testonly -- --coverage",
1414
"prepublishOnly": "pnpm run compile"
1515
},

modules/mongo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"start": "tsc --watch",
1010
"precompile": "pnpm run clean",
1111
"compile": "tsc",
12-
"testonly": "jest",
12+
"testonly": "jest --passWithNoTests",
1313
"coverage": "pnpm run testonly -- --coverage",
1414
"prepublishOnly": "pnpm run compile"
1515
},

modules/password/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"start": "tsc --watch",
1010
"precompile": "pnpm run clean",
1111
"compile": "pnpm run generate:graphql && tsc",
12-
"testonly": "jest",
12+
"testonly": "jest --passWithNoTests",
1313
"coverage": "pnpm run testonly -- --coverage",
1414
"generate:graphql": "gql-gen",
1515
"prepublishOnly": "pnpm run compile"

modules/typeorm/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"start": "tsc --watch",
1010
"precompile": "pnpm run clean",
1111
"compile": "tsc",
12-
"testonly": "jest",
12+
"testonly": "jest --passWithNoTests",
1313
"coverage": "pnpm run testonly -- --coverage",
1414
"prepublishOnly": "pnpm run compile"
1515
},

packages/database-typeorm/src/typeorm.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,18 @@ import { Inject, Injectable } from 'graphql-modules';
1818
global: true,
1919
})
2020
export class AccountsTypeorm implements DatabaseInterface {
21-
private userRepository: Repository<User> = null as any;
22-
private emailRepository: Repository<UserEmail> = null as any;
23-
private serviceRepository: Repository<UserService> = null as any;
24-
private sessionRepository: Repository<UserSession> = null as any;
21+
private userRepository!: Repository<User>;
22+
private emailRepository!: Repository<UserEmail>;
23+
private serviceRepository!: Repository<UserService>;
24+
private sessionRepository!: Repository<UserSession>;
2525

2626
constructor(
27-
@Inject(UserToken) private UserEntity: typeof User,
28-
@Inject(UserEmailToken) private UserEmailEntity: typeof UserEmail,
29-
@Inject(UserServiceToken) private UserServiceEntity: typeof UserService,
30-
@Inject(UserSessionToken) private UserSessionEntity: typeof UserSession,
3127
@Inject(AccountsTypeORMConfigToken) private options: AccountsTypeormOptions,
32-
private connection?: Connection
28+
private connection?: Connection,
29+
@Inject(UserToken) private UserEntity: typeof User = User,
30+
@Inject(UserEmailToken) private UserEmailEntity: typeof UserEmail = UserEmail,
31+
@Inject(UserServiceToken) private UserServiceEntity: typeof UserService = UserService,
32+
@Inject(UserSessionToken) private UserSessionEntity: typeof UserSession = UserSession
3333
) {
3434
if (this.connection == null && this.options.connectionName == null) {
3535
throw new Error('You must provide either a Connection or a ConnectionName');

packages/e2e/__tests__/core.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import 'reflect-metadata';
12
import { servers } from './servers';
23

34
const user = {

packages/e2e/__tests__/databases/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { DatabaseInterface } from '@accounts/types';
2+
import { Module } from 'graphql-modules';
23

34
export interface DatabaseTestInterface {
5+
databaseModule: Module;
46
accountsDatabase: DatabaseInterface;
57

68
start: () => Promise<void>;

packages/e2e/__tests__/databases/mongo.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ import { DatabaseInterface } from '@accounts/types';
33
// TODO rename to AccountsMongo ?
44
import { Mongo } from '@accounts/mongo';
55
import { DatabaseTestInterface } from './index';
6+
import { createAccountsMongoModule } from '@accounts/module-mongo';
67

78
const connectionString = 'mongodb://localhost/accounts-js-tests-e2e';
89

910
export class DatabaseTest implements DatabaseTestInterface {
11+
public databaseModule = createAccountsMongoModule({ dbConn: mongoose.connection });
1012
public accountsDatabase: DatabaseInterface;
1113

1214
constructor() {

0 commit comments

Comments
 (0)