Skip to content

Commit

Permalink
Merge pull request #10 from justin-tay/fix-type-error
Browse files Browse the repository at this point in the history
fix: type error due to customTesters in context but not in state
  • Loading branch information
debugmaster committed Feb 13, 2023
2 parents 469552f + 9e463f4 commit 9c13e53
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ describe('jsonContaining()', () => {
it('should pass', () => {
const testObj = { test: false }
expect(
jsonContaining.call(null, JSON.stringify(testObj), testObj)
jsonContaining.call(mockedState, JSON.stringify(testObj), testObj)
).toMatchObject({
pass: true
})
Expand All @@ -207,7 +207,7 @@ describe('jsonContaining()', () => {
const testObj = { test: false }
const anotherTestObj = { anotherTest: false }
expect(
jsonContaining.call(null, JSON.stringify(testObj), anotherTestObj)
jsonContaining.call(mockedState, JSON.stringify(testObj), anotherTestObj)
).toMatchObject({
pass: false
})
Expand Down
4 changes: 2 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@ export function toMatchJSON(this: MatcherState, received: unknown, jsonObject: a
return matchers.toMatchObject.call(this, JSON.parse(received as string), jsonObject)
}

export function jsonContaining(received: unknown, jsonObject: any): ExpectationResult {
return toMatchJSON.call(expect.getState() as MatcherState, received, jsonObject)
export function jsonContaining(this: MatcherState, received: unknown, jsonObject: any): ExpectationResult {
return toMatchJSON.call(this, received, jsonObject)
}

0 comments on commit 9c13e53

Please sign in to comment.