Skip to content

Commit df7f91a

Browse files
committed
fix: Fix It docstrings
Hovering over any matcher under `It` should now show its docstring.
1 parent 23d0a3a commit df7f91a

18 files changed

+267
-288
lines changed

src/errors/unexpected-call.spec.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import {
33
expectAnsilessEqual,
44
} from '../../tests/ansiless';
55
import { StrongExpectation } from '../expectation/strong-expectation';
6+
import { matches } from '../matchers/matcher';
67

7-
import { It } from '../matchers/it';
88
import { printArgsDiff, UnexpectedCall } from './unexpected-call';
99

1010
describe('UnexpectedCall', () => {
@@ -19,7 +19,7 @@ describe('UnexpectedCall', () => {
1919
});
2020

2121
it('should print the diff', () => {
22-
const matcher = It.matches(() => false, {
22+
const matcher = matches(() => false, {
2323
getDiff: (actual) => ({ actual, expected: 'foo' }),
2424
});
2525

@@ -33,7 +33,7 @@ describe('UnexpectedCall', () => {
3333
});
3434

3535
it('should print the diff only for expectations for the same property', () => {
36-
const matcher = It.matches(() => false, {
36+
const matcher = matches(() => false, {
3737
getDiff: (actual) => ({ actual, expected: 'foo' }),
3838
});
3939

@@ -51,7 +51,7 @@ describe('UnexpectedCall', () => {
5151
});
5252

5353
it("should contain actual and expected values when there's a single expectation remaining", () => {
54-
const matcher = It.matches(() => false, {
54+
const matcher = matches(() => false, {
5555
getDiff: () => ({ actual: 'actual', expected: 'expected' }),
5656
});
5757

src/expectation/strong-expectation.spec.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { expectAnsilessEqual } from '../../tests/ansiless';
2+
import { deepEquals } from '../matchers/deep-equals';
23

3-
import { It } from '../matchers/it';
44
import { StrongExpectation } from './strong-expectation';
55

66
describe('StrongExpectation', () => {
@@ -23,7 +23,7 @@ describe('StrongExpectation', () => {
2323
it('should match missing args against undefined', () => {
2424
const expectation = new StrongExpectation(
2525
'bar',
26-
[It.deepEquals(undefined)],
26+
[deepEquals(undefined)],
2727
{
2828
value: 23,
2929
}
@@ -39,7 +39,7 @@ describe('StrongExpectation', () => {
3939
});
4040

4141
it('should not match less args', () => {
42-
const expectation = new StrongExpectation('bar', [It.deepEquals(23)], {
42+
const expectation = new StrongExpectation('bar', [deepEquals(23)], {
4343
value: 23,
4444
});
4545

@@ -49,7 +49,7 @@ describe('StrongExpectation', () => {
4949
it('should not match expected undefined verses received defined arg', () => {
5050
const expectation = new StrongExpectation(
5151
'bar',
52-
[It.deepEquals(undefined)],
52+
[deepEquals(undefined)],
5353
{
5454
value: 23,
5555
}
@@ -69,7 +69,7 @@ describe('StrongExpectation', () => {
6969
it('should not match less args', () => {
7070
const expectation = new StrongExpectation(
7171
'bar',
72-
[It.deepEquals(23)],
72+
[deepEquals(23)],
7373
{
7474
value: 23,
7575
},
@@ -83,7 +83,7 @@ describe('StrongExpectation', () => {
8383
it('should print when, returns and invocation count', () => {
8484
const expectation = new StrongExpectation(
8585
'baz',
86-
[It.deepEquals(4), It.deepEquals(5), It.deepEquals(6)],
86+
[deepEquals(4), deepEquals(5), deepEquals(6)],
8787
{
8888
value: 42,
8989
}

src/index.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,16 @@ export { mock } from './mock/mock';
55
export { when } from './when/when';
66
export { reset, resetAll } from './verify/reset';
77
export { verify, verifyAll } from './verify/verify';
8-
export { It } from './matchers/it';
98
export { setDefaults } from './mock/defaults';
109

10+
import * as It from './matchers/it';
11+
12+
/**
13+
* Contains argument matchers that can be used to ignore arguments in an
14+
* expectation or to match complex arguments.
15+
*/
16+
export { It };
17+
1118
export type { Matcher } from './matchers/matcher';
1219
export type { MockOptions } from './mock/options';
1320
export { UnexpectedProperty } from './mock/options';

0 commit comments

Comments
 (0)