2024-04-18 13:49:08 +02:00
|
|
|
import { createTestConfig } from '../../../test/config/test-config';
|
2024-04-18 16:32:35 +02:00
|
|
|
import { RoleName, TEST_AUDIT_USER } from '../../types';
|
2024-04-18 13:49:08 +02:00
|
|
|
import { createFakeProjectService } from './createProjectService';
|
|
|
|
|
|
|
|
describe('enterprise extension: enable change requests', () => {
|
|
|
|
test('it calls the change request enablement function', async () => {
|
|
|
|
expect.assertions(1);
|
|
|
|
|
|
|
|
const config = createTestConfig();
|
|
|
|
const service = createFakeProjectService(config);
|
|
|
|
|
|
|
|
// @ts-expect-error: if we don't set this up, the test will fail due to a missing role.
|
2024-04-18 16:32:35 +02:00
|
|
|
service.accessService.createRole(
|
|
|
|
{
|
|
|
|
name: RoleName.OWNER,
|
|
|
|
description: 'Project owner',
|
|
|
|
createdByUserId: -1,
|
|
|
|
},
|
|
|
|
TEST_AUDIT_USER,
|
|
|
|
);
|
2024-04-18 13:49:08 +02:00
|
|
|
|
|
|
|
const projectId = 'fake-project-id';
|
|
|
|
await service.createProject(
|
|
|
|
{
|
|
|
|
id: projectId,
|
|
|
|
name: 'fake-project-name',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 5,
|
|
|
|
permissions: [],
|
|
|
|
isAPI: false,
|
|
|
|
},
|
2024-04-18 16:32:35 +02:00
|
|
|
TEST_AUDIT_USER,
|
2024-04-18 13:49:08 +02:00
|
|
|
async () => {
|
|
|
|
// @ts-expect-error: we want to verify that the project /has/
|
|
|
|
// been created when calling the function.
|
|
|
|
const project = await service.projectStore.get(projectId);
|
|
|
|
|
|
|
|
expect(project).toBeTruthy();
|
|
|
|
},
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|