From b0ba9a685e8f285d277c7f51cee56e9715f427ce Mon Sep 17 00:00:00 2001 From: Thomas Lynch Date: Sat, 9 Apr 2022 00:44:17 +1000 Subject: [PATCH] add test for add/edit perm/delete staff --- test/board.js | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/test/board.js b/test/board.js index 0b2f0539..889c349b 100644 --- a/test/board.js +++ b/test/board.js @@ -229,4 +229,58 @@ testing 123` expect(response2.status).toBe(404); }); + test('add staff', async () => { + const params = new URLSearchParams({ + _csrf: csrfToken, + username: 'test', + }); + const response = await fetch('http://localhost/forms/board/test/addstaff', { + headers: { + 'x-using-xhr': 'true', + 'cookie': sessionCookie, + }, + method: 'POST', + body: params, + redirect: 'manual', + }) + expect(response.ok).toBe(true); + }); + + test('edit staff permission', async () => { + const params = new URLSearchParams({ + _csrf: csrfToken, + username: 'test', + MANAGE_BOARD_BANS: '1', + MANAGE_BOARD_LOGS: '1', + MANAGE_BOARD_SETTINGS: '1', + }); + const response = await fetch('http://localhost/forms/board/test/editstaff', { + headers: { + 'x-using-xhr': 'true', + 'cookie': sessionCookie, + }, + method: 'POST', + body: params, + redirect: 'manual', + }) + expect(response.ok).toBe(true); + }); + + test('remove staff', async () => { + const params = new URLSearchParams({ + _csrf: csrfToken, + checkedstaff: 'test', + }); + const response = await fetch('http://localhost/forms/board/test/deletestaff', { + headers: { + 'x-using-xhr': 'true', + 'cookie': sessionCookie, + }, + method: 'POST', + body: params, + redirect: 'manual', + }) + expect(response.ok).toBe(true); + }); + });