Skip to content

Commit

Permalink
fix: Fix It docstrings
Browse files Browse the repository at this point in the history
Hovering over any matcher under `It` should now show its docstring.
  • Loading branch information
NiGhTTraX committed Sep 24, 2023
1 parent 23d0a3a commit df7f91a
Show file tree
Hide file tree
Showing 18 changed files with 267 additions and 288 deletions.
8 changes: 4 additions & 4 deletions src/errors/unexpected-call.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import {
expectAnsilessEqual,
} from '../../tests/ansiless';
import { StrongExpectation } from '../expectation/strong-expectation';
import { matches } from '../matchers/matcher';

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

describe('UnexpectedCall', () => {
Expand All @@ -19,7 +19,7 @@ describe('UnexpectedCall', () => {
});

it('should print the diff', () => {
const matcher = It.matches(() => false, {
const matcher = matches(() => false, {
getDiff: (actual) => ({ actual, expected: 'foo' }),
});

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

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

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

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

Expand Down
12 changes: 6 additions & 6 deletions src/expectation/strong-expectation.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expectAnsilessEqual } from '../../tests/ansiless';
import { deepEquals } from '../matchers/deep-equals';

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

describe('StrongExpectation', () => {
Expand All @@ -23,7 +23,7 @@ describe('StrongExpectation', () => {
it('should match missing args against undefined', () => {
const expectation = new StrongExpectation(
'bar',
[It.deepEquals(undefined)],
[deepEquals(undefined)],
{
value: 23,
}
Expand All @@ -39,7 +39,7 @@ describe('StrongExpectation', () => {
});

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

Expand All @@ -49,7 +49,7 @@ describe('StrongExpectation', () => {
it('should not match expected undefined verses received defined arg', () => {
const expectation = new StrongExpectation(
'bar',
[It.deepEquals(undefined)],
[deepEquals(undefined)],
{
value: 23,
}
Expand All @@ -69,7 +69,7 @@ describe('StrongExpectation', () => {
it('should not match less args', () => {
const expectation = new StrongExpectation(
'bar',
[It.deepEquals(23)],
[deepEquals(23)],
{
value: 23,
},
Expand All @@ -83,7 +83,7 @@ describe('StrongExpectation', () => {
it('should print when, returns and invocation count', () => {
const expectation = new StrongExpectation(
'baz',
[It.deepEquals(4), It.deepEquals(5), It.deepEquals(6)],
[deepEquals(4), deepEquals(5), deepEquals(6)],
{
value: 42,
}
Expand Down
9 changes: 8 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@ export { mock } from './mock/mock';
export { when } from './when/when';
export { reset, resetAll } from './verify/reset';
export { verify, verifyAll } from './verify/verify';
export { It } from './matchers/it';
export { setDefaults } from './mock/defaults';

import * as It from './matchers/it';

/**
* Contains argument matchers that can be used to ignore arguments in an
* expectation or to match complex arguments.
*/
export { It };

export type { Matcher } from './matchers/matcher';
export type { MockOptions } from './mock/options';
export { UnexpectedProperty } from './mock/options';
Loading

0 comments on commit df7f91a

Please sign in to comment.