When running mocha on the updated test/server/controllers/api/posts.spec.js file, the test fails with the following error:
2 passing (287ms)
1 failing
1) controllers.api.posts
POST /api/posts
"before each" hook:
Uncaught TypeError: websockets.broadcast is not a function
at controllers/api/posts.js:41:13
at RedisClient.<anonymous> (pubsub.js:12:3)
at return_pub_sub (node_modules/redis/index.js:786:18)
at RedisClient.return_reply (node_modules/redis/index.js:833:9)
at JavascriptRedisParser.returnReply (node_modules/redis/index.js:192:18)
at JavascriptRedisParser.execute (node_modules/redis-parser/lib/parser.js:574:12)
at Socket.<anonymous> (node_modules/redis/index.js:274:27)
at readableAddChunk (_stream_readable.js:176:18)
at Socket.Readable.push (_stream_readable.js:134:10)
at TCP.onread (net.js:547:20)
In the controllers/api/posts.js file, this is where the code breaks:
When running mocha on the updated
test/server/controllers/api/posts.spec.js
file, the test fails with the following error:In the
controllers/api/posts.js
file, this is where the code breaks:My guess is that
websockets
is not available to the testing code, but i'm unsure on how to resolve this.