mirror of
https://github.com/nowcommunity/nowdatabase.git
synced 2026-10-12 19:13:52 +03:00
* update some backend tests slightly, and update user right docs * improve locality updating tests * refactor species merge tests, and add more user rights tests to merging * fix locality user right issue with users being able to bypass project membership requirements by adding new projects when updating a project, and add tests * fix small, copilot suggested issues * change bigint value back to number, and fix hanging test * add error content checks and get request test for regions * add error content checks and reorder tests in time bound/time unit * add person get tests, update delete tests, and update user right docs * update museum tests * update testing docs * add tests for all user groups in project delete tests * add more user right tests to project/ and projects/ * Fix pid test Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Rename project get test describe block Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
40 lines
1.2 KiB
TypeScript
40 lines
1.2 KiB
TypeScript
import { afterAll, beforeAll, describe, expect, it } from '@jest/globals'
|
|
import { login, logout, noPermError, resetDatabase, resetDatabaseTimeout, send } from '../utils'
|
|
import { pool } from '../../utils/db'
|
|
|
|
describe('GET /project/:id', () => {
|
|
beforeAll(async () => {
|
|
await resetDatabase()
|
|
}, resetDatabaseTimeout)
|
|
|
|
afterAll(async () => {
|
|
await pool.end()
|
|
})
|
|
|
|
it('viewing project details fails for non-admin users', async () => {
|
|
await login('testSu', 'test')
|
|
const suResult = await send('project/3', 'GET')
|
|
expect(suResult.status).toEqual(200)
|
|
|
|
await login('testPl', 'test')
|
|
const plResult = await send('project/3', 'GET')
|
|
expect(plResult.status).toEqual(403)
|
|
expect(plResult.body).toEqual(noPermError)
|
|
|
|
await login('testEu', 'test')
|
|
const euResult = await send('project/3', 'GET')
|
|
expect(euResult.status).toEqual(403)
|
|
expect(euResult.body).toEqual(noPermError)
|
|
|
|
await login('testEr', 'test')
|
|
const erResult = await send('project/3', 'GET')
|
|
expect(erResult.status).toEqual(403)
|
|
expect(erResult.body).toEqual(noPermError)
|
|
|
|
logout()
|
|
const anonResult = await send('project/3', 'GET')
|
|
expect(anonResult.status).toEqual(403)
|
|
expect(anonResult.body).toEqual(noPermError)
|
|
})
|
|
})
|