Skip to content

Instantly share code, notes, and snippets.

@stoneboyindc
Created October 4, 2019 00:53
Show Gist options
  • Save stoneboyindc/73ac90af7fb2c5cdeca4bfadb9d0501f to your computer and use it in GitHub Desktop.
Save stoneboyindc/73ac90af7fb2c5cdeca4bfadb9d0501f to your computer and use it in GitHub Desktop.
nickchang@Nicks-MacBook-Pro:~/work/thinkful/tc/preet-singh/preet-bookmarks-server$ npm test
> express-boilerplate@1.0.0 test /Users/nickchang/work/thinkful/tc/preet-singh/preet-bookmarks-server
> mocha --require test/setup.js
App
::ffff:127.0.0.1 - - [04/Oct/2019:00:47:23 +0000] "GET / HTTP/1.1" 200 6
✓ GET / responds with 200 containing "Hello, world!"
Bookmarks Endpoints
GET /bookmarks
Given no bookmarks in database
::ffff:127.0.0.1 - - [04/Oct/2019:00:47:23 +0000] "GET /bookmarks HTTP/1.1" 200 2
✓ responds with a 200 and an empty list
Given there are bookmarks in database
1) "before each" hook: insert bookmarks for "responds with 200 and all of the articles"
GET /bookmarks/:id
Given no bookmarks
error: Bookmark with id 2323 not found
::ffff:127.0.0.1 - - [04/Oct/2019:00:47:23 +0000] "GET /bookmarks/2323 HTTP/1.1" 404 18
2) responds with 404
Given there are bookmarks in the database
3) "before each" hook: insert bookmarks for "responds with 200 and the specified bookmark"
2 passing (140ms)
3 failing
1) Bookmarks Endpoints
GET /bookmarks
Given there are bookmarks in database
"before each" hook: insert bookmarks for "responds with 200 and all of the articles":
insert into "bookmarks" ("description", "id", "rating", "title", "url") values ($1, $2, $3, $4, $5), ($6, $7, $8, $9, $10), ($11, $12, $13, $14, $15) - invalid input syntax for integer: "edd9cc47-7e38-4175-82a8-ee76ff415079"
error: invalid input syntax for integer: "edd9cc47-7e38-4175-82a8-ee76ff415079"
at Connection.parseE (node_modules/pg/lib/connection.js:604:11)
at Connection.parseMessage (node_modules/pg/lib/connection.js:401:19)
at Socket.<anonymous> (node_modules/pg/lib/connection.js:121:22)
at addChunk (_stream_readable.js:284:12)
at readableAddChunk (_stream_readable.js:265:11)
at Socket.Readable.push (_stream_readable.js:220:10)
at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
From previous event:
at Client_PG._query (node_modules/knex/lib/dialects/postgres/index.js:234:12)
at Client_PG.query (node_modules/knex/lib/client.js:158:17)
at Runner.query (node_modules/knex/lib/runner.js:135:36)
at /Users/nickchang/work/thinkful/tc/preet-singh/preet-bookmarks-server/node_modules/knex/lib/runner.js:39:23
From previous event:
at Runner.run (node_modules/knex/lib/runner.js:25:16)
at Builder.Target.then (node_modules/knex/lib/interface.js:14:43)
2) Bookmarks Endpoints
GET /bookmarks/:id
Given no bookmarks
responds with 404:
Error: expected { error: { message: 'Bookmark doesn\'t exist' } } response body, got {}
+ expected - actual
-{}
+{
+ "error": {
+ "message": "Bookmark doesn't exist"
+ }
+}
at error (node_modules/supertest/lib/test.js:301:13)
at Test._assertBody (node_modules/supertest/lib/test.js:205:14)
at Test._assertFunction (node_modules/supertest/lib/test.js:283:11)
at Test.assert (node_modules/supertest/lib/test.js:173:18)
at Server.localAssert (node_modules/supertest/lib/test.js:131:12)
at emitCloseNT (net.js:1609:8)
at process._tickCallback (internal/process/next_tick.js:63:19)
3) Bookmarks Endpoints
GET /bookmarks/:id
Given there are bookmarks in the database
"before each" hook: insert bookmarks for "responds with 200 and the specified bookmark":
insert into "bookmarks" ("description", "id", "rating", "title", "url") values ($1, $2, $3, $4, $5), ($6, $7, $8, $9, $10), ($11, $12, $13, $14, $15) - invalid input syntax for integer: "837ea5d0-6974-434d-9695-76cc84ce467f"
error: invalid input syntax for integer: "837ea5d0-6974-434d-9695-76cc84ce467f"
at Connection.parseE (node_modules/pg/lib/connection.js:604:11)
at Connection.parseMessage (node_modules/pg/lib/connection.js:401:19)
at Socket.<anonymous> (node_modules/pg/lib/connection.js:121:22)
at addChunk (_stream_readable.js:284:12)
at readableAddChunk (_stream_readable.js:265:11)
at Socket.Readable.push (_stream_readable.js:220:10)
at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
From previous event:
at Client_PG._query (node_modules/knex/lib/dialects/postgres/index.js:234:12)
at Client_PG.query (node_modules/knex/lib/client.js:158:17)
at Runner.query (node_modules/knex/lib/runner.js:135:36)
at /Users/nickchang/work/thinkful/tc/preet-singh/preet-bookmarks-server/node_modules/knex/lib/runner.js:39:23
From previous event:
at Runner.run (node_modules/knex/lib/runner.js:25:16)
at Builder.Target.then (node_modules/knex/lib/interface.js:14:43)
npm ERR! Test failed. See above for more details.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment