Page 490 - Nodejs 교과서 개정2판
P. 490
addFollowing ஶ܀۞о async ೣࣻ۽ awaitਸ ࠢৈঠ ஶ܀۞о प೯ ৮ܐػ റ expect ೣࣻо प೯ؾ
פ Ӓؘ۠ పझח पಁפ
콘솔
$ npm test
> nodebird@0.0.1 test C:\Users\zerocho\nodebird
> jest
PASS routes/middlewares.test.js
FAIL controllers/user.test.js
● Console
console.error controllers/user.js:10
TypeError: Cannot convert undefined or null to object
console.error controllers/user.js:10
TypeError: Cannot convert undefined or null to object
console.error controllers/user.js:10
TypeError: Cannot convert undefined or null to object
● addFollowing › 용자를 찾아 팔로잉을 추가하고 success를 응답해야 함
expect(jest.fn()).toBeCalledWith(...expected)
Expected: "success"
Number of calls: 0
13 | test('사용자를 찾아 팔로잉을 추가하고 success를 응답해야 함', async () => {
14 | await addFollowing(req, res, next);
> 15 | expect(res.send).toBeCalledWith('success');
| ^
16 | });
17 |
18 | test('사용자를 못 찾으면 res.status(404).send(no user)를 호출함', async () => {
at Object.<anonymous> (controllers/user.test.js:15:22)
● addFollowing › 용자를 못 찾으면 res.status(404).send(no user)를 호출함
expect(jest.fn()).toBeCalledWith(...expected)
Expected: 404