1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00

Chore: use createApiTokenService instead of newing it up (#7560)

PR #7519 introduced the pattern of using `createApiTokenService` instead
of newing it up. This usage was introduced in a concurrent PR (#7503),
so we're just cleaning up and making the usage consistent.
This commit is contained in:
Thomas Heartman 2024-07-09 14:11:56 +02:00 committed by GitHub
parent 2e5d81cb89
commit e2c6d468e4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -9,7 +9,7 @@ import { RoleName } from '../../types/model';
import { randomId } from '../../util/random-id';
import EnvironmentService from '../project-environments/environment-service';
import IncompatibleProjectError from '../../error/incompatible-project-error';
import { ApiTokenService, EventService } from '../../services';
import { type ApiTokenService, EventService } from '../../services';
import { FeatureEnvironmentEvent } from '../../types/events';
import { addDays, subDays } from 'date-fns';
import {
@ -30,6 +30,7 @@ import type { User } from '../../server-impl';
import { BadDataError, InvalidOperationError } from '../../error';
import { DEFAULT_ENV, extractAuditInfoFromUser } from '../../util';
import { ApiTokenType } from '../../types/models/api-token';
import { createApiTokenService } from '../api-tokens/createApiTokenService';
let stores: IUnleashStores;
let db: ITestDb;
@ -91,7 +92,7 @@ beforeAll(async () => {
environmentService = new EnvironmentService(stores, config, eventService);
projectService = createProjectService(db.rawDatabase, config);
apiTokenService = new ApiTokenService(stores, config, eventService);
apiTokenService = createApiTokenService(db.rawDatabase, config);
});
beforeEach(async () => {
await stores.accessStore.addUserToRole(opsUser.id, 1, '');