const { isEmail } = require('./validation');
test('입력한 이메일 주소에는 "@" 문자가 1개만 있어야 이메일 형식이다.', ()=>{
expect(isEmail('[email protected]')).toEqual(true);
expect(isEmail('my-emaildomain.com')).toEqual(false);
expect(isEmail('my-email@@domain.com')).toEqual(false);
});
⇒ 과제1 최종 코드
const app = require('../app');
const supertest = require('supertest');
describe('html을 반환하는 api',()=>{
test('/index.html 경로에 요청했을 때 status code가 200이어야 한다.', async () => {
const res = await supertest(app).get('/index.html');
expect(res.status).toEqual(200);
});
test('/test.html 경로에 요청했을 때 status code가 404이어야 한다.', async () => {
const res = await supertest(app).get('/test.html');
expect(res.status).toEqual(404);
});
});
describe('json / string을 반환하는 api',()=>{
test("/api/goods/add/crawling 경로에 요청했을 때 status code가 200이어야 한다.", async () => {
const res = await supertest(app).get("/api/goods/add/crawling");
expect(res.status).toEqual(200);
});
});