From eb39a212ce8e729b89873dd7da0fce5105cd952e Mon Sep 17 00:00:00 2001 From: Thomas Heartman Date: Thu, 6 Jun 2024 14:16:45 +0200 Subject: [PATCH] chore: test that the tags API still returns tags that you can't create anymore (#7304) This change adds a test to the tags API to ensure that even if you can't create tags that are pure whitespace anymore, you'll still receive pre-existing tags from the API that fit this description. The test is here to ensure that we don't break this in future versions of Unleash. --- src/test/e2e/api/admin/tags.e2e.test.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/test/e2e/api/admin/tags.e2e.test.ts b/src/test/e2e/api/admin/tags.e2e.test.ts index db17cfe42e..a98b95e206 100644 --- a/src/test/e2e/api/admin/tags.e2e.test.ts +++ b/src/test/e2e/api/admin/tags.e2e.test.ts @@ -209,3 +209,10 @@ test('Can bulk remove tags', async () => { }) .expect(200); }); + +test('backward compatibility: the API should return invalid tag names if they exist', async () => { + const tag = { value: ' ', type: 'simple' }; + await db.stores.tagStore.createTag(tag); + const { body } = await app.request.get('/api/admin/tags').expect(200); + expect(body.tags).toContainEqual(tag); +});