-
-
Notifications
You must be signed in to change notification settings - Fork 721
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add enterprise extension point to enable change requests on pr…
…oject creation (#6881) This PR adds an optional function parameter to the `createProject` function that is intended to enable change requests for the newly created project. The assumption is that all the logic within will be decided in the enterprise impl. The only thing we want to verify here is that it is called after the project has been created.
- Loading branch information
1 parent
bda5eda
commit bf4c29b
Showing
2 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { createTestConfig } from '../../../test/config/test-config'; | ||
import { RoleName } from '../../types'; | ||
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. | ||
service.accessService.createRole({ | ||
name: RoleName.OWNER, | ||
description: 'Project owner', | ||
createdByUserId: -1, | ||
}); | ||
|
||
const projectId = 'fake-project-id'; | ||
await service.createProject( | ||
{ | ||
id: projectId, | ||
name: 'fake-project-name', | ||
}, | ||
{ | ||
id: 5, | ||
permissions: [], | ||
isAPI: false, | ||
}, | ||
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(); | ||
}, | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters