deno_std
deno_std copied to clipboard
Support the Response object in assertObjectMatch
Is your feature request related to a problem? Please describe.
I'm creating some tests for a server handler, and assertObjectMatch didn't work as expected on the responses.
Describe the solution you'd like
That
assertObjectMatch(new Response(), { status: 200 });
assertObjectMatch(new Response(null, { status: 400, statusText: "Not Found" }), { status: 400, statusText: "Not Found" });
would work.
Describe alternatives you've considered
The Response object does not have enumerable properties, so there's no elegant way to convert it into a plain object.
An alternative is to map the values manually:
const response = new Response()
assertObjectMatch(
{
status: response.status
},
{
status: 200
}
)