Skip to content

Instantly share code, notes, and snippets.

@nedgrady
Created November 18, 2024 19:01
Show Gist options
  • Save nedgrady/54f589fb3ecc8cbb7cfa8f6d7d140dbc to your computer and use it in GitHub Desktop.
Save nedgrady/54f589fb3ecc8cbb7cfa8f6d7d140dbc to your computer and use it in GitHub Desktop.
expect.extend({
toBeRequest(received: http.ClientRequest, expected: http.ClientRequest) {
const pass = received === expected
return {
pass,
message: () => `Expected requests${this.isNot ? "not " : ""} to be equal`,
// expected/actual object graphs are displayed under the test failure message
expected: { method: expected.method, path: expected.path, requestId: expected.getHeader("x-request-id") },
actual: { method: received.method, path: received.path, requestId: received.getHeader("x-request-id") },
}
},
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment