Skip to content

Instantly share code, notes, and snippets.

@apapirovski
Last active September 26, 2017 06:41
Show Gist options
  • Save apapirovski/fe8768a4dab535155270d869a9e24a8a to your computer and use it in GitHub Desktop.
Save apapirovski/fe8768a4dab535155270d869a9e24a8a to your computer and use it in GitHub Desktop.
1) OPTIONS when error occurs in response handler should pass error to callback:
Error: expected 'true' response body, got 'GET,HEAD'
at error (node_modules/supertest/lib/test.js:275:13)
at Test._assertBody (node_modules/supertest/lib/test.js:201:16)
at Test._assertFunction (node_modules/supertest/lib/test.js:257:11)
at Test.assert (node_modules/supertest/lib/test.js:158:18)
at assert (node_modules/supertest/lib/test.js:137:12)
at node_modules/supertest/lib/test.js:134:5
at Test.Request.callback (node_modules/superagent/lib/node/index.js:691:12)
at IncomingMessage.<anonymous> (node_modules/superagent/lib/node/index.js:922:12)
at endReadableNT (_stream_readable.js:202:243)
at _combinedTickCallback (internal/process/next_tick.js:18:932)
at process._tickCallback (internal/process/next_tick.js:36:23)
2) middleware .next() should behave like connect:
TypeError: Cannot read property 'header' of undefined
at Test._assertHeader (node_modules/supertest/lib/test.js:218:20)
at Test._assertFunction (node_modules/supertest/lib/test.js:257:11)
at Test.assert (node_modules/supertest/lib/test.js:158:18)
at assert (node_modules/supertest/lib/test.js:137:12)
at node_modules/supertest/lib/test.js:134:5
at Test.Request.callback (node_modules/superagent/lib/node/index.js:687:12)
at ClientRequest.<anonymous> (node_modules/superagent/lib/node/index.js:639:10)
at Socket.socketErrorListener (_http_client.js:63:54)
at Stream.onStreamError (node_modules/spdy/lib/spdy/handle.js:110:18)
at writeAfterEnd (node_modules/readable-stream/lib/_stream_writable.js:278:10)
at Stream.Writable.write (node_modules/readable-stream/lib/_stream_writable.js:320:20)
at Handle._writeEnc (node_modules/handle-thing/lib/handle.js:346:18)
at Handle.<anonymous> (node_modules/handle-thing/lib/handle.js:328:14)
at Handle.setStream (node_modules/handle-thing/lib/handle.js:79:8)
at Agent.<anonymous> (node_modules/spdy/lib/spdy/agent.js:195:16)
at node_modules/spdy/lib/spdy/agent.js:71:10
at Socket.<anonymous> (node_modules/spdy/lib/spdy/agent.js:165:5)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:153:464)
3) req .ip when X-Forwarded-For is present when "trust proxy" is disabled should return the remote address:
TypeError: Cannot read property 'address' of undefined
at getExpectedClientAddress (test/req.ip.js:94:17)
at Context.<anonymous> (test/req.ip.js:67:28)
4) req .ip when X-Forwarded-For is not present should return the remote address:
TypeError: Cannot read property 'address' of undefined
at getExpectedClientAddress (test/req.ip.js:94:17)
at Context.<anonymous> (test/req.ip.js:83:26)
5) res .append(field, val) should accept array of values:
AssertionError: expected Array [ Array [ 'foo=bar', 'fizz=buzz' ] ] to equal Array [ 'foo=bar', 'fizz=buzz' ] (at length, A has 1 and B has 2)
+ expected - actual
[
- [
- "foo=bar"
- "fizz=buzz"
- ]
+ "foo=bar"
+ "fizz=buzz"
]
at Assertion.fail (node_modules/should/cjs/should.js:258:17)
at Assertion.value (node_modules/should/cjs/should.js:335:19)
at test/res.append.js:42:43
at Test._assertFunction (node_modules/supertest/lib/test.js:257:11)
at Test.assert (node_modules/supertest/lib/test.js:158:18)
at assert (node_modules/supertest/lib/test.js:137:12)
at node_modules/supertest/lib/test.js:134:5
at Test.Request.callback (node_modules/superagent/lib/node/index.js:691:12)
at IncomingMessage.<anonymous> (node_modules/superagent/lib/node/index.js:922:12)
at endReadableNT (_stream_readable.js:202:243)
at _combinedTickCallback (internal/process/next_tick.js:18:932)
at process._tickCallback (internal/process/next_tick.js:36:23)
6) res .append(field, val) should work with cookies:
AssertionError: expected Array [ Array [ 'foo=bar; Path=/', 'bar=baz' ] ] to equal Array [ 'foo=bar; Path=/', 'bar=baz' ] (at length, A has 1 and B has 2)
+ expected - actual
[
- [
- "foo=bar; Path=/"
- "bar=baz"
- ]
+ "foo=bar; Path=/"
+ "bar=baz"
]
at Assertion.fail (node_modules/should/cjs/should.js:258:17)
at Assertion.value (node_modules/should/cjs/should.js:335:19)
at test/res.append.js:100:43
at Test._assertFunction (node_modules/supertest/lib/test.js:257:11)
at Test.assert (node_modules/supertest/lib/test.js:158:18)
at assert (node_modules/supertest/lib/test.js:137:12)
at node_modules/supertest/lib/test.js:134:5
at Test.Request.callback (node_modules/superagent/lib/node/index.js:691:12)
at IncomingMessage.<anonymous> (node_modules/superagent/lib/node/index.js:922:12)
at endReadableNT (_stream_readable.js:202:243)
at _combinedTickCallback (internal/process/next_tick.js:18:932)
at process._tickCallback (internal/process/next_tick.js:36:23)
7) res .cookie(name, string) should allow multiple calls:
Uncaught AssertionError: expected Array [
Array [ 'name=tobi; Path=/', 'age=1; Path=/', 'gender=%3F; Path=/' ]
] to equal Array [ 'name=tobi; Path=/', 'age=1; Path=/', 'gender=%3F; Path=/' ] (at length, A has 1 and B has 3)
+ expected - actual
[
- [
- "name=tobi; Path=/"
- "age=1; Path=/"
- "gender=%3F; Path=/"
- ]
+ "name=tobi; Path=/"
+ "age=1; Path=/"
+ "gender=%3F; Path=/"
]
at Assertion.fail (node_modules/should/cjs/should.js:258:17)
at Assertion.value (node_modules/should/cjs/should.js:335:19)
at Test.<anonymous> (test/res.cookie.js:52:42)
at Test.assert (node_modules/supertest/lib/test.js:166:6)
at assert (node_modules/supertest/lib/test.js:137:12)
at node_modules/supertest/lib/test.js:134:5
at Test.Request.callback (node_modules/superagent/lib/node/index.js:691:12)
at IncomingMessage.<anonymous> (node_modules/superagent/lib/node/index.js:922:12)
at endReadableNT (_stream_readable.js:202:243)
at _combinedTickCallback (internal/process/next_tick.js:18:932)
at process._tickCallback (internal/process/next_tick.js:36:23)
8) res .cookie(name, string, options) signed should generate a signed JSON cookie:
Uncaught TypeError: val.split is not a function
at Test.<anonymous> (test/res.cookie.js:137:34)
at Test.assert (node_modules/supertest/lib/test.js:166:6)
at assert (node_modules/supertest/lib/test.js:137:12)
at node_modules/supertest/lib/test.js:134:5
at Test.Request.callback (node_modules/superagent/lib/node/index.js:691:12)
at IncomingMessage.<anonymous> (node_modules/superagent/lib/node/index.js:922:12)
at endReadableNT (_stream_readable.js:202:243)
at _combinedTickCallback (internal/process/next_tick.js:18:932)
at process._tickCallback (internal/process/next_tick.js:36:23)
9) res when accepting html should escape the url:
TypeError: Cannot read property 'header' of undefined
at Test._assertHeader (node_modules/supertest/lib/test.js:218:20)
at Test._assertFunction (node_modules/supertest/lib/test.js:257:11)
at Test.assert (node_modules/supertest/lib/test.js:158:18)
at assert (node_modules/supertest/lib/test.js:137:12)
at node_modules/supertest/lib/test.js:134:5
at Test.Request.callback (node_modules/superagent/lib/node/index.js:687:12)
at ClientRequest.<anonymous> (node_modules/superagent/lib/node/index.js:639:10)
at Socket.socketErrorListener (_http_client.js:63:54)
at Stream.onStreamError (node_modules/spdy/lib/spdy/handle.js:110:18)
at Stream._handleRST (node_modules/spdy-transport/lib/spdy-transport/stream.js:281:10)
at Stream._handleFrame (node_modules/spdy-transport/lib/spdy-transport/stream.js:126:10)
at Connection._handleFrame (node_modules/spdy-transport/lib/spdy-transport/connection.js:324:12)
at Parser.<anonymous> (node_modules/spdy-transport/lib/spdy-transport/connection.js:156:10)
at addChunk (node_modules/readable-stream/lib/_stream_readable.js:284:12)
at readableAddChunk (node_modules/readable-stream/lib/_stream_readable.js:271:11)
at Parser.Readable.push (node_modules/readable-stream/lib/_stream_readable.js:238:10)
at Parser.Transform.push (node_modules/readable-stream/lib/_stream_transform.js:146:32)
at next (node_modules/spdy-transport/lib/spdy-transport/protocol/base/parser.js:53:12)
at node_modules/spdy-transport/lib/spdy-transport/protocol/http2/parser.js:72:5
at Parser.onRSTFrame (node_modules/spdy-transport/lib/spdy-transport/protocol/http2/parser.js:368:3)
at Parser.onFrameBody (node_modules/spdy-transport/lib/spdy-transport/protocol/http2/parser.js:144:10)
at Parser.execute (node_modules/spdy-transport/lib/spdy-transport/protocol/http2/parser.js:64:8)
at Parser._consume (node_modules/spdy-transport/lib/spdy-transport/protocol/base/parser.js:95:8)
at node_modules/spdy-transport/lib/spdy-transport/protocol/base/parser.js:62:12
at _combinedTickCallback (internal/process/next_tick.js:18:697)
at process._tickCallback (internal/process/next_tick.js:36:23)
10) res when accepting text should encode the url:
TypeError: Cannot read property 'header' of undefined
at Test._assertHeader (node_modules/supertest/lib/test.js:218:20)
at Test._assertFunction (node_modules/supertest/lib/test.js:257:11)
at Test.assert (node_modules/supertest/lib/test.js:158:18)
at assert (node_modules/supertest/lib/test.js:137:12)
at node_modules/supertest/lib/test.js:134:5
at Test.Request.callback (node_modules/superagent/lib/node/index.js:687:12)
at ClientRequest.<anonymous> (node_modules/superagent/lib/node/index.js:639:10)
at Socket.socketErrorListener (_http_client.js:63:54)
at Stream.onStreamError (node_modules/spdy/lib/spdy/handle.js:110:18)
at Stream._handleRST (node_modules/spdy-transport/lib/spdy-transport/stream.js:281:10)
at Stream._handleFrame (node_modules/spdy-transport/lib/spdy-transport/stream.js:126:10)
at Connection._handleFrame (node_modules/spdy-transport/lib/spdy-transport/connection.js:324:12)
at Parser.<anonymous> (node_modules/spdy-transport/lib/spdy-transport/connection.js:156:10)
at addChunk (node_modules/readable-stream/lib/_stream_readable.js:284:12)
at readableAddChunk (node_modules/readable-stream/lib/_stream_readable.js:271:11)
at Parser.Readable.push (node_modules/readable-stream/lib/_stream_readable.js:238:10)
at Parser.Transform.push (node_modules/readable-stream/lib/_stream_transform.js:146:32)
at next (node_modules/spdy-transport/lib/spdy-transport/protocol/base/parser.js:53:12)
at node_modules/spdy-transport/lib/spdy-transport/protocol/http2/parser.js:72:5
at Parser.onRSTFrame (node_modules/spdy-transport/lib/spdy-transport/protocol/http2/parser.js:368:3)
at Parser.onFrameBody (node_modules/spdy-transport/lib/spdy-transport/protocol/http2/parser.js:144:10)
at Parser.execute (node_modules/spdy-transport/lib/spdy-transport/protocol/http2/parser.js:64:8)
at Parser._consume (node_modules/spdy-transport/lib/spdy-transport/protocol/base/parser.js:95:8)
at node_modules/spdy-transport/lib/spdy-transport/protocol/base/parser.js:62:12
at _combinedTickCallback (internal/process/next_tick.js:18:697)
at process._tickCallback (internal/process/next_tick.js:36:23)
11) auth GET /login should display login error:
Uncaught TypeError: res.headers.set-cookie[0].split is not a function
at getCookie (test/acceptance/auth.js:5:39)
at Test.<anonymous> (test/acceptance/auth.js:35:24)
at Test.assert (node_modules/supertest/lib/test.js:166:6)
at assert (node_modules/supertest/lib/test.js:137:12)
at node_modules/supertest/lib/test.js:134:5
at Test.Request.callback (node_modules/superagent/lib/node/index.js:703:3)
at IncomingMessage.<anonymous> (node_modules/superagent/lib/node/index.js:922:12)
at endReadableNT (_stream_readable.js:202:243)
at _combinedTickCallback (internal/process/next_tick.js:18:932)
at process._tickCallback (internal/process/next_tick.js:36:23)
12) auth GET /restricted should succeed with proper cookie:
Uncaught TypeError: res.headers.set-cookie[0].split is not a function
at getCookie (test/acceptance/auth.js:5:39)
at Test.<anonymous> (test/acceptance/auth.js:68:24)
at Test.assert (node_modules/supertest/lib/test.js:166:6)
at assert (node_modules/supertest/lib/test.js:137:12)
at node_modules/supertest/lib/test.js:134:5
at Test.Request.callback (node_modules/superagent/lib/node/index.js:703:3)
at IncomingMessage.<anonymous> (node_modules/superagent/lib/node/index.js:922:12)
at endReadableNT (_stream_readable.js:202:243)
at _combinedTickCallback (internal/process/next_tick.js:18:932)
at process._tickCallback (internal/process/next_tick.js:36:23)
13) cookie-sessions GET / should set a session cookie:
Error: expected "Set-Cookie" header field
at Test._assertHeader (node_modules/supertest/lib/test.js:219:30)
at Test._assertFunction (node_modules/supertest/lib/test.js:257:11)
at Test.assert (node_modules/supertest/lib/test.js:158:18)
at assert (node_modules/supertest/lib/test.js:137:12)
at node_modules/supertest/lib/test.js:134:5
at Test.Request.callback (node_modules/superagent/lib/node/index.js:691:12)
at IncomingMessage.<anonymous> (node_modules/superagent/lib/node/index.js:922:12)
at endReadableNT (_stream_readable.js:202:243)
at _combinedTickCallback (internal/process/next_tick.js:18:932)
at process._tickCallback (internal/process/next_tick.js:36:23)
14) cookie-sessions GET / should display 1 view on revisit:
Uncaught TypeError: Cannot read property 'map' of undefined
at getCookies (test/acceptance/cookie-sessions.js:35:36)
at Test.<anonymous> (test/acceptance/cookie-sessions.js:27:24)
at Test.assert (node_modules/supertest/lib/test.js:166:6)
at assert (node_modules/supertest/lib/test.js:137:12)
at node_modules/supertest/lib/test.js:134:5
at Test.Request.callback (node_modules/superagent/lib/node/index.js:691:12)
at IncomingMessage.<anonymous> (node_modules/superagent/lib/node/index.js:922:12)
at endReadableNT (_stream_readable.js:202:243)
at _combinedTickCallback (internal/process/next_tick.js:18:932)
at process._tickCallback (internal/process/next_tick.js:36:23)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment