Skip to content

Commit

Permalink
test: speed up the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kwasniew committed Oct 24, 2023
1 parent 8bb209d commit b515891
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
9 changes: 8 additions & 1 deletion src/test/e2e/api/auth/simple-password-provider.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const password = 'DtUYwi&l5I1KX4@Le';
let userService: UserService;
let adminUser: IUser;

beforeEach(async () => {
beforeAll(async () => {
db = await dbInit('simple_password_provider_api_serial', getLogger);
stores = db.stores;
app = await setupApp(stores);
Expand Down Expand Up @@ -61,8 +61,15 @@ beforeEach(async () => {
});
});

beforeEach(async () => {
app = await setupApp(stores);
});

afterEach(async () => {
await app.destroy();
});

afterAll(async () => {
await db.destroy();
});

Expand Down
8 changes: 6 additions & 2 deletions src/test/e2e/stores/client-metrics-store-v2.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,20 @@ let db;
let stores: IUnleashStores;
let clientMetricsStore: IClientMetricsStoreV2;

beforeEach(async () => {
beforeAll(async () => {
db = await dbInit('client_metrics_store_v2_e2e_serial', getLogger);
stores = db.stores;
clientMetricsStore = stores.clientMetricsStoreV2;
});

afterEach(async () => {
afterAll(async () => {
await db.destroy();
});

beforeEach(async () => {
await stores.clientMetricsStoreV2.deleteAll();
});

test('Should store single list of metrics', async () => {
const metrics: IClientMetricsEnv[] = [
{
Expand Down
4 changes: 2 additions & 2 deletions src/test/e2e/stores/feature-environment-store.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ let featureEnvironmentStore: IFeatureEnvironmentStore;
let featureStore: IFeatureToggleStore;
let environmentStore: IEnvironmentStore;

beforeEach(async () => {
beforeAll(async () => {
db = await dbInit('feature_environment_store_serial', getLogger);
stores = db.stores;
featureEnvironmentStore = stores.featureEnvironmentStore;
environmentStore = stores.environmentStore;
featureStore = stores.featureToggleStore;
});

afterEach(async () => {
afterAll(async () => {
await db.destroy();
});

Expand Down

0 comments on commit b515891

Please sign in to comment.