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
@@ -1,14 +1,14 @@
import { afterAll, afterEach, beforeAll, beforeEach, describe, expect} from "@jest/globals";
import { init, TestPlatform } from "../setup";
import TestHelpers from "../common/common_test_helpers";
import UserApi from "../common/user-api";
describe("The /users/quota API", () => {
let platform: TestPlatform;
let currentUser: TestHelpers;
let currentUser: UserApi;
beforeEach(async () => {
platform = await init();
currentUser = await TestHelpers.getInstance(platform);
currentUser = await UserApi.getInstance(platform);
}, 30000000);
afterEach(async () => {
@@ -3,7 +3,7 @@ import { init, TestPlatform } from "../setup";
import { TestDbService } from "../utils.prepare.db";
import { v1 as uuidv1 } from "uuid";
import { CompanyLimitsEnum } from "../../../src/services/user/web/types";
import TestHelpers from "../common/common_test_helpers";
import UserApi from "../common/user-api";
describe("The /users API", () => {
const url = "/internal/services/users/v1";
@@ -213,7 +213,7 @@ describe("The /users API", () => {
});
it("shouldn't return anonymous accounts ", async () => {
const oneUser = await TestHelpers.getInstance(platform, true);
const oneUser = await UserApi.getInstance(platform, true);
const response = await platform.app.inject({
method: "GET",