Files
recipe-manager/server/jest/tests/routes/recipe.test.ts
2022-12-17 12:22:03 -06:00

27 lines
815 B
TypeScript

import supertest from 'supertest'
import loginUser from '../../helpers/loginUser';
import { IRecipe } from '../../../schemas'
import dotenv from 'dotenv';
import app from '../../..';
dotenv.config();
const APISTRING = process.env.APISTRING || 'localhost:8080';
const server = supertest.agent(app);
describe('/recipe', () => {
beforeAll(() => {
server.post('/auth/login')
.send({ email: 'verifieduser@test.com', password: 'coolpassword' });
})
describe('GET /', () => {
it('gets an array of recipes', () => {
server.get('/recipe').end((err, res) => {
if (err) throw err;
console.log(res.body);
expect(res.statusCode).toBe(200);
expect(res.body.ok).toBeTruthy();
});
});
});
});