diff --git a/src/lib/services/tag-type-service.ts b/src/lib/services/tag-type-service.ts index 6b55339eab..91a531a1e4 100644 --- a/src/lib/services/tag-type-service.ts +++ b/src/lib/services/tag-type-service.ts @@ -74,11 +74,12 @@ export default class TagTypeService { } async deleteTagType(name: string, userName: string): Promise { + 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, }); } diff --git a/src/test/e2e/api/admin/tag-types.e2e.test.ts b/src/test/e2e/api/admin/tag-types.e2e.test.ts index 926d5baa7a..2134ea0191 100644 --- a/src/test/e2e/api/admin/tag-types.e2e.test.ts +++ b/src/test/e2e/api/admin/tag-types.e2e.test.ts @@ -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 () => {