mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	fix: tag type deleted should indicate data deletion (#5437)
This commit is contained in:
		
							parent
							
								
									abf57d1c70
								
							
						
					
					
						commit
						581b238378
					
				@ -74,11 +74,12 @@ export default class TagTypeService {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    async deleteTagType(name: string, userName: string): Promise<void> {
 | 
					    async deleteTagType(name: string, userName: string): Promise<void> {
 | 
				
			||||||
 | 
					        const tagType = await this.tagTypeStore.get(name);
 | 
				
			||||||
        await this.tagTypeStore.delete(name);
 | 
					        await this.tagTypeStore.delete(name);
 | 
				
			||||||
        await this.eventService.storeEvent({
 | 
					        await this.eventService.storeEvent({
 | 
				
			||||||
            type: TAG_TYPE_DELETED,
 | 
					            type: TAG_TYPE_DELETED,
 | 
				
			||||||
            createdBy: userName || 'unleash-system',
 | 
					            createdBy: userName || 'unleash-system',
 | 
				
			||||||
            data: { name },
 | 
					            preData: tagType,
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -158,13 +158,15 @@ test('Invalid tag-types get refused by validator', async () => {
 | 
				
			|||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
test('Can delete tag type', async () => {
 | 
					test('Can delete tag type', async () => {
 | 
				
			||||||
    expect.assertions(0);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    await app.request
 | 
					    await app.request
 | 
				
			||||||
        .delete('/api/admin/tag-types/simple')
 | 
					        .delete('/api/admin/tag-types/simple')
 | 
				
			||||||
        .set('Content-Type', 'application/json')
 | 
					        .set('Content-Type', 'application/json')
 | 
				
			||||||
        .expect(200);
 | 
					        .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 () => {
 | 
					test('Non unique tag-types gets rejected', async () => {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user