changes to testing from last session

This commit is contained in:
Mikayla Dobson
2022-12-26 13:03:21 -06:00
parent 6c3f835b25
commit ba4d72b431
2 changed files with 10 additions and 2 deletions

View File

@@ -1,8 +1,9 @@
export default function loginUser(server: any) { export default function loginUser(server: any) {
server.post('/auth/login') server.post('/auth/login')
.send({ email: 'verifieduser@test.com', password: 'coolpassword' }) .send({ email: 'verifieduser@test.com', password: 'coolpassword' })
.end((err: any, res: Response) => { .end((err: any, res: any) => {
if (err) throw err; if (err) throw err;
console.log(res);
expect(res.status).toBe(200); expect(res.status).toBe(200);
}) })
} }

View File

@@ -7,7 +7,14 @@ const server = supertest.agent(APISTRING);
describe('login user', () => { describe('login user', () => {
beforeAll(() => { beforeAll(() => {
loginUser(server); server.post('/auth/login')
.send({ email: 'verifieduser@test.com', password: 'coolpassword' })
.end((err, res) => {
console.log(res);
if (err) throw err;
expect(res.status).toBe(200);
}
)
}) })
it('allows access to protected resources', () => { it('allows access to protected resources', () => {