-
-
Notifications
You must be signed in to change notification settings - Fork 734
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: prevent revive flag/flags in archived project (#7826)
- Loading branch information
Showing
2 changed files
with
55 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
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 |
---|---|---|
|
@@ -773,3 +773,40 @@ test('Should not allow to add flags to archived projects', async () => { | |
), | ||
); | ||
}); | ||
|
||
test('Should not allow to revive flags to archived projects', async () => { | ||
const project = await stores.projectStore.create({ | ||
id: 'archivedProjectWithFlag', | ||
name: 'archivedProjectWithFlag', | ||
}); | ||
const flag = await service.createFeatureToggle( | ||
project.id, | ||
{ | ||
name: 'archiveFlag', | ||
}, | ||
TEST_AUDIT_USER, | ||
); | ||
|
||
await service.archiveToggle( | ||
flag.name, | ||
{ email: '[email protected]' } as User, | ||
TEST_AUDIT_USER, | ||
); | ||
await stores.projectStore.archive(project.id); | ||
|
||
await expect( | ||
service.reviveFeature(flag.name, TEST_AUDIT_USER), | ||
).rejects.toEqual( | ||
new NotFoundError( | ||
`Active project with id archivedProjectWithFlag does not exist`, | ||
), | ||
); | ||
|
||
await expect( | ||
service.reviveFeatures([flag.name], project.id, TEST_AUDIT_USER), | ||
).rejects.toEqual( | ||
new NotFoundError( | ||
`Active project with id archivedProjectWithFlag does not exist`, | ||
), | ||
); | ||
}); |