From 6606d96aaa2a4a8e716e0c49df05078c09bd0bc6 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Wed, 11 Oct 2023 14:09:27 -0400 Subject: [PATCH] test: fix flag tests --- test/flags.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/test/flags.js b/test/flags.js index 15dc14533b..914e9ae72a 100644 --- a/test/flags.js +++ b/test/flags.js @@ -126,6 +126,10 @@ describe('Flags', () => { ({ flagId } = await Flags.create('post', postData.pid, adminUid, utils.generateUUID())); }); + after(async () => { + Flags.purge([flagId]); + }); + it('should add a report to an existing flag', async () => { await Flags.addReport(flagId, 'post', postData.pid, uid3, utils.generateUUID(), Date.now()); @@ -157,6 +161,10 @@ describe('Flags', () => { ({ flagId } = await Flags.create('post', postData.pid, adminUid, utils.generateUUID())); }); + after(async () => { + Flags.purge([flagId]); + }); + it('should remove a report from an existing flag', async () => { await Flags.create('post', postData.pid, uid3, utils.generateUUID()); await Flags.rescindReport('post', postData.pid, uid3); @@ -986,7 +994,7 @@ describe('Flags', () => { it('should update a flag\'s properties', async () => { const { response } = await request({ method: 'put', - uri: `${nconf.get('url')}/api/v3/flags/2`, + uri: `${nconf.get('url')}/api/v3/flags/4`, jar, headers: { 'x-csrf-token': csrfToken, @@ -1008,7 +1016,7 @@ describe('Flags', () => { it('should remove a flag\'s report', async () => { const response = await request({ method: 'delete', - uri: `${nconf.get('url')}/api/v3/flags/2/report`, + uri: `${nconf.get('url')}/api/v3/flags/4/report`, jar, headers: { 'x-csrf-token': csrfToken, @@ -1024,7 +1032,7 @@ describe('Flags', () => { it('should append a note to the flag', async () => { const { response } = await request({ method: 'post', - uri: `${nconf.get('url')}/api/v3/flags/2/notes`, + uri: `${nconf.get('url')}/api/v3/flags/4/notes`, jar, headers: { 'x-csrf-token': csrfToken, @@ -1052,7 +1060,7 @@ describe('Flags', () => { it('should delete a note from a flag', async () => { const { response } = await request({ method: 'delete', - uri: `${nconf.get('url')}/api/v3/flags/2/notes/1626446956652`, + uri: `${nconf.get('url')}/api/v3/flags/4/notes/1626446956652`, jar, headers: { 'x-csrf-token': csrfToken,