Page 505 - Nodejs 교과서 개정2판
P. 505
const message = encodeURIComponent('로그인한 상태입니다.');
agent
.post('/auth/join')
.send({
email: 'zerohch0@gmail.com',
nick: 'zerocho1',
password: 'nodejsbook',
})
.expect('Location', `/?error=${message}`)
.expect(302, done);
});
});
afterAll(async () => {
await sequelize.sync({ force: true });
});
рױೞѱ sync ݫࢲ٘ী force: trueܳ ֍য ప࠶ਸ द ٜ݅ѱ ೮णפ द௬ۄૉܳ ॳ ঋ؊ۄب afte
rAllী ؘఠܳ ܻೞח ٘ܳ ֍ਵݶ ؾפ పझܳ द ࣻ೯ೞݶ ࢿҕפ Ѿҗח ࢤۚೞѷणפ
ഥਗоੑ పझח լਵפ ۽Ӓੋҗ ۽Ӓইਓө పझ೧ࠁѷणפ
routes/auth.test.js
...
describe('POST /login', () => {
test('가입되지 않은 회원', (done) => {
const message = encodeURIComponent('가입되지 않은 회원입니다.');
request(app)
.post('/auth/login')
.send({
email: 'zerohch1@gmail.com',
password: 'nodejsbook',
})
.expect('Location', `/?loginError=${message}`)
.expect(302, done);
});
test('로그인 수행', (done) => {
request(app)
.post('/auth/login')
.send({
email: 'zerohch0@gmail.com',
password: 'nodejsbook',
})