Skip to content

Instantly share code, notes, and snippets.

@nedgrady
Last active November 18, 2024 18:27
Show Gist options
  • Save nedgrady/4e39932965c993b6d5935d4f832235c3 to your computer and use it in GitHub Desktop.
Save nedgrady/4e39932965c993b6d5935d4f832235c3 to your computer and use it in GitHub Desktop.
test("the returned duplicates contain the first request", () => {
const request1 = new http.ClientRequest({
method: "GET",
path: "/some-long-running-endpoint",
headers: {
"x-request-id": "123",
authorization: "user1",
},
})
const request2 = new http.ClientRequest({
method: "GET",
path: "/some-long-running-endpoint",
headers: {
"x-request-id": "456",
authorization: "user1",
},
})
const requestsByUser = dedupeRequests([request1, request2])
expect(requestsByUser.get("user1")[0]).toBeRequest(request1)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment