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