Skip to content

Commit

Permalink
Add user.test.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
aelassas committed Feb 17, 2024
1 parent d11210a commit 63c5186
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions api/tests/user.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import 'dotenv/config'
import * as DatabaseHelper from '../src/common/DatabaseHelper'
import * as TestHelper from './TestHelper'

//
// Connecting and initializing the database before running the test suite
//
beforeAll(async () => {
if (await DatabaseHelper.Connect(false)) {
await TestHelper.initializeDatabase()
}
})

//
// Closing and cleaning the database connection after running the test suite
//
afterAll(async () => {
await TestHelper.clearDatabase()

await DatabaseHelper.Close(false)
})

//
// Unit tests
//

describe('POST /api/sign-up', () => {
it('should create a user', async () => {

// TODO

})
})

describe('POST /api/admin-sign-up', () => {
it('should create an admin user', async () => {

// TODO

})
})

describe('POST /api/create-user', () => {
it('should create a user', async () => {
const token = await TestHelper.signinAsAdmin()

// TODO

await TestHelper.signout(token)
})
})

// TODO Add remaining tests

0 comments on commit 63c5186

Please sign in to comment.