Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support the Response object in assertObjectMatch #2204

Open
oles opened this issue May 9, 2022 · 0 comments
Open

Support the Response object in assertObjectMatch #2204

oles opened this issue May 9, 2022 · 0 comments

Comments

@oles
Copy link

oles commented May 9, 2022

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
    }
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant