Skip to content

Commit

Permalink
fix: Make isNumber pretty print consistently with other matchers
Browse files Browse the repository at this point in the history
  • Loading branch information
NiGhTTraX committed Jun 27, 2020
1 parent bebbaae commit bc5f4f8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/matcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ const isNumber = (): Matcher<number> =>
({
__isMatcher: true,
matches: (arg: any) => typeof arg === 'number' && !Number.isNaN(arg),
toJSON: () => 'isNumber',
toJSON: () => 'number',
} as any);

/**
Expand Down
4 changes: 4 additions & 0 deletions tests/matcher.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ describe('It', () => {
it('should not match NaN', () => {
expect(It.isNumber().matches(NaN)).toBeFalsy();
});

it('should pretty print', () => {
expect(It.isNumber().toJSON()).toEqual('number');
});
});

describe('isString', () => {
Expand Down

0 comments on commit bc5f4f8

Please sign in to comment.