Skip to content

Commit

Permalink
chore: fix outdated tests and ts-expect-error for notIncludeDeepMembers
Browse files Browse the repository at this point in the history
  • Loading branch information
ThisIsMissEm committed Dec 3, 2024
1 parent 50b89e6 commit ba4a3a6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
8 changes: 3 additions & 5 deletions src/assert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1515,12 +1515,10 @@ export class Assert extends Macroable implements AssertContract {
* ) // fails
*/
notIncludeDeepMembers(
...args: Parameters<ChaiAssert['includeDeepMembers']>
): ReturnType<ChaiAssert['includeDeepMembers']> {
...args: Parameters<ChaiAssert['notIncludeDeepMembers']>
): ReturnType<ChaiAssert['notIncludeDeepMembers']> {
this.incrementAssertionsCount()

// @ts-expect-error not in @types/chai
return assert['notIncludeDeepMembers'](...args)
return assert.notIncludeDeepMembers(...args)
}

/**
Expand Down
16 changes: 8 additions & 8 deletions tests/assert/assert.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2023,19 +2023,19 @@ test.describe('assert', function () {

expectError(function () {
assert.closeTo([1.5] as any, 1.0, 0.5, 'blah')
}, 'blah: expected [ 1.5 ] to be a number')
}, 'blah: expected [ 1.5 ] to be numeric')

expectError(function () {
assert.closeTo(1.5, '1.0' as any, 0.5, 'blah')
}, 'blah: the arguments to closeTo or approximately must be numbers')
}, "blah: expected '1.0' to be numeric")

expectError(function () {
assert.closeTo(1.5, 1.0, true as any, 'blah')
}, 'blah: the arguments to closeTo or approximately must be numbers')
}, 'blah: expected true to be numeric')

expectError(function () {
assert.closeTo(1.5, 1.0, undefined as any, 'blah')
}, 'blah: the arguments to closeTo or approximately must be numbers, and a delta is required')
}, 'blah: A `delta` value is required for `closeTo`')
})

test('approximately', function () {
Expand All @@ -2055,19 +2055,19 @@ test.describe('assert', function () {

expectError(function () {
assert.approximately([1.5] as any, 1.0, 0.5)
}, 'expected [ 1.5 ] to be a number')
}, 'expected [ 1.5 ] to be numeric')

expectError(function () {
assert.approximately(1.5, '1.0' as any, 0.5, 'blah')
}, 'blah: the arguments to closeTo or approximately must be numbers')
}, "blah: expected '1.0' to be numeric")

expectError(function () {
assert.approximately(1.5, 1.0, true as any, 'blah')
}, 'blah: the arguments to closeTo or approximately must be numbers')
}, 'blah: expected true to be numeric')

expectError(function () {
assert.approximately(1.5, 1.0, undefined as any, 'blah')
}, 'blah: the arguments to closeTo or approximately must be numbers, and a delta is required')
}, 'blah: A `delta` value is required for `closeTo`')
})

test('sameMembers', function () {
Expand Down

0 comments on commit ba4a3a6

Please sign in to comment.