1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

fix: tag type deleted should indicate data deletion (#5437)

This commit is contained in:
Mateusz Kwasniewski 2023-11-27 14:49:33 +01:00 committed by GitHub
parent abf57d1c70
commit 581b238378
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View File

@ -74,11 +74,12 @@ export default class TagTypeService {
}
async deleteTagType(name: string, userName: string): Promise<void> {
const tagType = await this.tagTypeStore.get(name);
await this.tagTypeStore.delete(name);
await this.eventService.storeEvent({
type: TAG_TYPE_DELETED,
createdBy: userName || 'unleash-system',
data: { name },
preData: tagType,
});
}

View File

@ -158,13 +158,15 @@ test('Invalid tag-types get refused by validator', async () => {
});
test('Can delete tag type', async () => {
expect.assertions(0);
await app.request
.delete('/api/admin/tag-types/simple')
.set('Content-Type', 'application/json')
.expect(200);
return app.request.get('/api/admin/tag-types/simple').expect(404);
await app.request.get('/api/admin/tag-types/simple').expect(404);
const { body } = await app.getRecordedEvents();
expect(body.events[0].preData).toMatchObject({ name: 'simple' });
expect(body.events[0].data).toBe(null);
});
test('Non unique tag-types gets rejected', async () => {