Test refactoring, make test more stable (#374)

- Move copy-pasted code to User API
- Clean the database after each test
- Refactor documents search test
This commit is contained in:
Anton Shepilov
2024-02-26 00:04:04 +01:00
committed by GitHub
parent 488aafe284
commit e0aca9dcd5
20 changed files with 719 additions and 909 deletions
@@ -36,7 +36,6 @@ export class TestDbService {
public company: Company;
public users: User[];
private workspacesMap: Map<string, { workspace: Workspace; users: User[] }>;
private userService;
rand = () => Math.floor(Math.random() * 100000);
private database: DatabaseServiceAPI;
@@ -256,6 +255,10 @@ export class TestDbService {
return this;
}
async cleanUp() {
await this.database.getConnector().drop()
}
getRepository = (type, entity) => {
return this.database.getRepository<typeof entity>(type, entity);
};