mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-18 02:20:49 +01:00
test: fix flag tests
This commit is contained in:
@@ -126,6 +126,10 @@ describe('Flags', () => {
|
|||||||
({ flagId } = await Flags.create('post', postData.pid, adminUid, utils.generateUUID()));
|
({ 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 () => {
|
it('should add a report to an existing flag', async () => {
|
||||||
await Flags.addReport(flagId, 'post', postData.pid, uid3, utils.generateUUID(), Date.now());
|
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()));
|
({ 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 () => {
|
it('should remove a report from an existing flag', async () => {
|
||||||
await Flags.create('post', postData.pid, uid3, utils.generateUUID());
|
await Flags.create('post', postData.pid, uid3, utils.generateUUID());
|
||||||
await Flags.rescindReport('post', postData.pid, uid3);
|
await Flags.rescindReport('post', postData.pid, uid3);
|
||||||
@@ -986,7 +994,7 @@ describe('Flags', () => {
|
|||||||
it('should update a flag\'s properties', async () => {
|
it('should update a flag\'s properties', async () => {
|
||||||
const { response } = await request({
|
const { response } = await request({
|
||||||
method: 'put',
|
method: 'put',
|
||||||
uri: `${nconf.get('url')}/api/v3/flags/2`,
|
uri: `${nconf.get('url')}/api/v3/flags/4`,
|
||||||
jar,
|
jar,
|
||||||
headers: {
|
headers: {
|
||||||
'x-csrf-token': csrfToken,
|
'x-csrf-token': csrfToken,
|
||||||
@@ -1008,7 +1016,7 @@ describe('Flags', () => {
|
|||||||
it('should remove a flag\'s report', async () => {
|
it('should remove a flag\'s report', async () => {
|
||||||
const response = await request({
|
const response = await request({
|
||||||
method: 'delete',
|
method: 'delete',
|
||||||
uri: `${nconf.get('url')}/api/v3/flags/2/report`,
|
uri: `${nconf.get('url')}/api/v3/flags/4/report`,
|
||||||
jar,
|
jar,
|
||||||
headers: {
|
headers: {
|
||||||
'x-csrf-token': csrfToken,
|
'x-csrf-token': csrfToken,
|
||||||
@@ -1024,7 +1032,7 @@ describe('Flags', () => {
|
|||||||
it('should append a note to the flag', async () => {
|
it('should append a note to the flag', async () => {
|
||||||
const { response } = await request({
|
const { response } = await request({
|
||||||
method: 'post',
|
method: 'post',
|
||||||
uri: `${nconf.get('url')}/api/v3/flags/2/notes`,
|
uri: `${nconf.get('url')}/api/v3/flags/4/notes`,
|
||||||
jar,
|
jar,
|
||||||
headers: {
|
headers: {
|
||||||
'x-csrf-token': csrfToken,
|
'x-csrf-token': csrfToken,
|
||||||
@@ -1052,7 +1060,7 @@ describe('Flags', () => {
|
|||||||
it('should delete a note from a flag', async () => {
|
it('should delete a note from a flag', async () => {
|
||||||
const { response } = await request({
|
const { response } = await request({
|
||||||
method: 'delete',
|
method: 'delete',
|
||||||
uri: `${nconf.get('url')}/api/v3/flags/2/notes/1626446956652`,
|
uri: `${nconf.get('url')}/api/v3/flags/4/notes/1626446956652`,
|
||||||
jar,
|
jar,
|
||||||
headers: {
|
headers: {
|
||||||
'x-csrf-token': csrfToken,
|
'x-csrf-token': csrfToken,
|
||||||
|
|||||||
Reference in New Issue
Block a user