Skip to content

Commit

Permalink
test(refactor): use 'toEqual' instead of 'toStrictEqual' for Responses (
Browse files Browse the repository at this point in the history
#329)

<!-- Issues are required for both bug fixes and features. -->
Resolves #328

----

## Behavior

### Before the change?
<!-- Please describe the current behavior that you are modifying. -->
Test assertions of Responses from `fetch-mock` are done with
`jest.toStrictEqual` with `JSON.stringify`

### After the change?
<!-- Please describe the behavior or changes that are being added by
this PR. -->
Test assertions of Responses from `fetch-mock` are done with
`jest.toEqual`


### Other information
<!-- Any other information that is important to this PR  -->
More context in octokit/core.js#588

----

## Additional info

### Pull request checklist
- [x] Tests for the changes have been added (for bug fixes / features)
- [ ] Docs have been reviewed and added / updated if needed (for bug
fixes / features)
- [ ] Added the appropriate label for the given change

### Does this introduce a breaking change?
<!-- If this introduces a breaking change make sure to note it here any
what the impact might be -->

Please see our docs on [breaking
changes](https://github.com/octokit/.github/blob/main/community/breaking_changes.md)
to help!

- [ ] Yes (Please add the `Type: Breaking change` label)
- [x] No

If `Yes`, what's the impact:

* N/A


### Pull request type
`Type: Maintenance`

----
  • Loading branch information
oscard0m committed Jul 19, 2023
1 parent 688f86a commit 0303720
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions test/scenarios/errors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,13 @@ describe("api.github.com", () => {
expect(error.message).toEqual(
`Validation Failed: {"resource":"Label","code":"invalid","field":"color"}`,
);
// To-Do: Figure out why the objects are not strictly equal
expect(JSON.stringify(error.response.data.errors)).toStrictEqual(
JSON.stringify([
{
resource: "Label",
code: "invalid",
field: "color",
},
]),
);
expect(error.response.data.errors).toEqual([
{
resource: "Label",
code: "invalid",
field: "color",
},
]);
expect(error.response.data.documentation_url).toMatch(
new RegExp("rest/reference/issues#create-a-label"),
);
Expand Down

0 comments on commit 0303720

Please sign in to comment.