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

fix: type error due to customTesters in context but not in state #10

Merged
merged 1 commit into from
Feb 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 {
debugmaster marked this conversation as resolved.
Show resolved Hide resolved
return toMatchJSON.call(this, received, jsonObject)
}