Page 491 - Nodejs 교과서 개정2판
P. 491

Number	of	calls:	0


           								19	|			test('사용자를	못	찾으면	res.status(404).send(no	user)를	호출함',	async	()	=>	{
           								20	|					await	addFollowing(req,	res,	next);
           						>	21	|					expect(res.status).toBeCalledWith(404);
           											|																								^
           								22	|					expect(res.send).toBeCalledWith('no	user');
           								23	|			});
           								24	|


           								at	Object.<anonymous>	(controllers/user.test.js:21:24)


           				●	addFollowing	›	DB에서	에러가	발생하면	next(error)	호출함


           						expect(jest.fn()).toBeCalledWith(...expected)


           						Expected:	"테스트용	에러"
           						Received
           													1:	[TypeError:	Cannot	convert	undefined	or	null	to	object]
           													2:	[TypeError:	Cannot	convert	undefined	or	null	to	object]
           													3:	[TypeError:	Cannot	convert	undefined	or	null	to	object]


           								26	|					const	error	=	'테스트용	에러';
           								27	|					await	addFollowing(req,	res,	next);
           						>	28	|					expect(next).toBeCalledWith(error);
           											|																		^
           								22	|			});
           								23	|	});
           								24	|


           								at	Object.<anonymous>	(controllers/user.test.js:21:18)


           Test	Suites:	1	failed,	1	passed,	2	total
           Tests:							2	failed,	4	passed,	6	total
           Snapshots:			0	total
           Time:								3.602s
           Ran	all	test	suites.
           npm	ERR!	Test	failed.	See	above	for	more	details.




         ߄۽ 6TFS ݽ؛ ٸޙੑפ׮  addFollowing ஶ౟܀۞ উীח 6TFSۄח ݽ؛੉ ٜয ੓णפ׮  ੉ ݽ؛਷ पઁ
         ؘ੉ఠ߬੉झ৬ োѾغয ੓ਵ޲۽ పझ౟ ജ҃ীࢲח ࢎਊೡ ࣻ হणפ׮  ٮۄࢲ 6TFS ݽ؛ب ݽఊ೧ঠ ೤פ

         ׮
   486   487   488   489   490   491   492   493   494   495   496