strong-mock 8.0.0-beta.1 → 8.0.0-beta.2
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.
- package/README.md +93 -50
- package/dist/errors.d.ts +4 -4
- package/dist/expectation/expectation.d.ts +3 -7
- package/dist/expectation/it.d.ts +1 -1
- package/dist/expectation/repository/expectation-repository.d.ts +6 -6
- package/dist/expectation/repository/flexible-repository.d.ts +8 -7
- package/dist/expectation/repository/return-value.d.ts +13 -0
- package/dist/expectation/strong-expectation.d.ts +6 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +250 -285
- package/dist/index.js.map +1 -1
- package/dist/mock/defaults.d.ts +1 -1
- package/dist/mock/map.d.ts +4 -4
- package/dist/mock/mock.d.ts +8 -6
- package/dist/mock/options.d.ts +51 -24
- package/dist/mock/stub.d.ts +5 -14
- package/dist/print.d.ts +3 -2
- package/dist/proxy.d.ts +1 -1
- package/dist/return/invocation-count.d.ts +1 -1
- package/dist/return/returns.d.ts +11 -7
- package/dist/verify/reset.d.ts +1 -1
- package/dist/verify/verify.d.ts +2 -2
- package/dist/when/pending-expectation.d.ts +20 -19
- package/dist/when/when.d.ts +7 -2
- package/package.json +4 -4
package/dist/verify/verify.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ExpectationRepository } from '../expectation/repository/expectation-repository';
|
|
2
|
-
import { Mock } from '../mock/mock';
|
|
1
|
+
import type { ExpectationRepository } from '../expectation/repository/expectation-repository';
|
|
2
|
+
import type { Mock } from '../mock/mock';
|
|
3
3
|
export declare const verifyRepo: (repository: ExpectationRepository) => void;
|
|
4
4
|
/**
|
|
5
5
|
* Verify that all expectations on the given mock have been met.
|
|
@@ -1,30 +1,31 @@
|
|
|
1
|
-
import { Expectation
|
|
2
|
-
import {
|
|
3
|
-
import { ConcreteMatcher } from '../mock/options';
|
|
4
|
-
import { Property } from '../proxy';
|
|
5
|
-
|
|
1
|
+
import type { Expectation } from '../expectation/expectation';
|
|
2
|
+
import type { ReturnValue } from '../expectation/repository/return-value';
|
|
3
|
+
import type { ConcreteMatcher } from '../mock/options';
|
|
4
|
+
import type { Property } from '../proxy';
|
|
5
|
+
/**
|
|
6
|
+
* An expectation has to be built incrementally, starting first with the property
|
|
7
|
+
* being accessed inside {@link createStub}, then any arguments passed to it, and ending
|
|
8
|
+
* it with the returned value from {@link createReturns}.
|
|
9
|
+
*/
|
|
6
10
|
export interface PendingExpectation {
|
|
7
|
-
|
|
11
|
+
setProperty(prop: Property): void;
|
|
12
|
+
setArgs(args: any[] | undefined): void;
|
|
8
13
|
finish(returnValue: ReturnValue): Expectation;
|
|
9
|
-
clear(): void;
|
|
10
|
-
property: Property;
|
|
11
|
-
args: any[] | undefined;
|
|
12
14
|
/**
|
|
13
15
|
* Used by `pretty-format`.
|
|
14
16
|
*/
|
|
15
17
|
toJSON(): string;
|
|
16
18
|
}
|
|
17
|
-
export declare
|
|
19
|
+
export declare type ExpectationFactory = (property: Property, args: any[] | undefined, returnValue: ReturnValue, concreteMatcher: ConcreteMatcher, exactParams: boolean) => Expectation;
|
|
20
|
+
export declare class PendingExpectationWithFactory implements PendingExpectation {
|
|
18
21
|
private createExpectation;
|
|
19
|
-
private
|
|
20
|
-
private
|
|
21
|
-
private
|
|
22
|
-
private
|
|
23
|
-
constructor(createExpectation: ExpectationFactory);
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
set args(value: any[] | undefined);
|
|
22
|
+
private concreteMatcher;
|
|
23
|
+
private exactParams;
|
|
24
|
+
private args;
|
|
25
|
+
private property;
|
|
26
|
+
constructor(createExpectation: ExpectationFactory, concreteMatcher: ConcreteMatcher, exactParams: boolean);
|
|
27
|
+
setProperty(value: Property): void;
|
|
28
|
+
setArgs(value: any[] | undefined): void;
|
|
27
29
|
finish(returnValue: ReturnValue): Expectation;
|
|
28
|
-
clear(): void;
|
|
29
30
|
toJSON(): string;
|
|
30
31
|
}
|
package/dist/when/when.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
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
|
+
}
|
|
2
6
|
/**
|
|
3
7
|
* Set an expectation on a mock.
|
|
4
8
|
*
|
|
@@ -24,4 +28,5 @@ import { Stub } from '../return/returns';
|
|
|
24
28
|
* const fn = mock<(x: number) => Promise<number>();
|
|
25
29
|
* when(() => fn(23)).thenResolve(42);
|
|
26
30
|
*/
|
|
27
|
-
export declare const when:
|
|
31
|
+
export declare const when: When;
|
|
32
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "strong-mock",
|
|
3
|
-
"version": "8.0.0-beta.
|
|
3
|
+
"version": "8.0.0-beta.2",
|
|
4
4
|
"description": "Simple type safe mocking library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"tdd",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"dist"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"jest-matcher-utils": "~
|
|
24
|
+
"jest-matcher-utils": "~28.1.0",
|
|
25
25
|
"lodash": "~4.17.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
@@ -32,14 +32,14 @@
|
|
|
32
32
|
"@types/node": "~17.0.8",
|
|
33
33
|
"@types/lodash": "~4.14.0",
|
|
34
34
|
"doctoc": "~2.2.0",
|
|
35
|
-
"eslint": "~8.
|
|
35
|
+
"eslint": "~8.24.0",
|
|
36
36
|
"jest": "~28.1.3",
|
|
37
37
|
"microbundle": "~0.15.0",
|
|
38
38
|
"standard-version": "~9.5.0",
|
|
39
39
|
"strip-ansi": "~6.0.0",
|
|
40
40
|
"strong-mock": "~6.0.0",
|
|
41
41
|
"tslib": "~2.4.0",
|
|
42
|
-
"typescript": "~4.
|
|
42
|
+
"typescript": "~4.8.0"
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|
|
45
45
|
"docs": "doctoc --title '**Table of Contents**' README.md",
|