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',
           						})
   500   501   502   503   504   505   506   507   508   509   510