strong-mock 9.0.1 → 9.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +41 -25
  2. package/dist/index.cjs +1191 -0
  3. package/dist/index.d.cts +584 -0
  4. package/dist/index.d.ts +584 -14
  5. package/dist/index.js +658 -842
  6. package/package.json +35 -21
  7. package/dist/errors/api.d.ts +0 -13
  8. package/dist/errors/diff.d.ts +0 -4
  9. package/dist/errors/unexpected-access.d.ts +0 -5
  10. package/dist/errors/unexpected-call.d.ts +0 -14
  11. package/dist/errors/verify.d.ts +0 -8
  12. package/dist/expectation/expectation.d.ts +0 -27
  13. package/dist/expectation/repository/expectation-repository.d.ts +0 -90
  14. package/dist/expectation/repository/flexible-repository.d.ts +0 -38
  15. package/dist/expectation/repository/return-value.d.ts +0 -13
  16. package/dist/expectation/strong-expectation.d.ts +0 -30
  17. package/dist/index.js.map +0 -1
  18. package/dist/matchers/contains-object.d.ts +0 -28
  19. package/dist/matchers/deep-equals.d.ts +0 -16
  20. package/dist/matchers/is-any.d.ts +0 -11
  21. package/dist/matchers/is-array.d.ts +0 -22
  22. package/dist/matchers/is-number.d.ts +0 -12
  23. package/dist/matchers/is-plain-object.d.ts +0 -17
  24. package/dist/matchers/is-string.d.ts +0 -15
  25. package/dist/matchers/is.d.ts +0 -9
  26. package/dist/matchers/it.d.ts +0 -10
  27. package/dist/matchers/matcher.d.ts +0 -93
  28. package/dist/matchers/will-capture.d.ts +0 -21
  29. package/dist/mock/defaults.d.ts +0 -11
  30. package/dist/mock/map.d.ts +0 -16
  31. package/dist/mock/mock.d.ts +0 -24
  32. package/dist/mock/mode.d.ts +0 -6
  33. package/dist/mock/options.d.ts +0 -99
  34. package/dist/mock/stub.d.ts +0 -5
  35. package/dist/print.d.ts +0 -10
  36. package/dist/proxy.d.ts +0 -48
  37. package/dist/return/invocation-count.d.ts +0 -44
  38. package/dist/return/returns.d.ts +0 -61
  39. package/dist/verify/reset.d.ts +0 -20
  40. package/dist/verify/verify.d.ts +0 -27
  41. package/dist/when/expectation-builder.d.ts +0 -26
  42. package/dist/when/when.d.ts +0 -32
@@ -1,32 +0,0 @@
1
- import type { NonPromiseStub, PromiseStub } from '../return/returns';
2
- interface When {
3
- <R>(expectation: () => Promise<R>): PromiseStub<R, Promise<R>>;
4
- <R>(expectation: () => R): NonPromiseStub<R>;
5
- }
6
- /**
7
- * Set an expectation on a mock.
8
- *
9
- * The expectation must be finished by setting a return value, even if the value
10
- * is `undefined`.
11
- *
12
- * If a call happens that was not expected then the mock will throw an error.
13
- * By default, the call is expected to only be made once. Use the invocation
14
- * count helpers to expect a call multiple times.
15
- *
16
- * @param expectation A callback to set the expectation on your mock. The
17
- * callback must return the value from the mock to properly infer types.
18
- *
19
- * @example
20
- * const fn = mock<() => void>();
21
- * when(() => fn()).thenReturn(undefined);
22
- *
23
- * @example
24
- * const fn = mock<() => number>();
25
- * when(() => fn()).thenReturn(42).atMost(3);
26
- *
27
- * @example
28
- * const fn = mock<(x: number) => Promise<number>();
29
- * when(() => fn(23)).thenResolve(42);
30
- */
31
- export declare const when: When;
32
- export {};