@rcompat/test 0.19.0 → 0.19.1
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 +6 -10
- package/lib/private/E.d.ts +1 -1
- package/lib/private/extend.d.ts +1 -1
- package/lib/private/intercept.d.ts +1 -1
- package/lib/private/to-object.d.ts +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -284,10 +284,10 @@ Use `spy` to wrap a function and record every call made to it. The wrapped
|
|
|
284
284
|
function behaves identically to the original but tracks its arguments.
|
|
285
285
|
|
|
286
286
|
```ts
|
|
287
|
-
import
|
|
287
|
+
import test from "@rcompat/test";
|
|
288
288
|
|
|
289
289
|
const add = (a: number, b: number) => a + b;
|
|
290
|
-
const tracked = spy(add);
|
|
290
|
+
const tracked = test.spy(add);
|
|
291
291
|
|
|
292
292
|
tracked(1, 2);
|
|
293
293
|
tracked(3, 4);
|
|
@@ -301,10 +301,9 @@ Use `spy` inside a test case to make call-tracking assertions:
|
|
|
301
301
|
|
|
302
302
|
```ts
|
|
303
303
|
import test from "@rcompat/test";
|
|
304
|
-
import spy from "@rcompat/spy";
|
|
305
304
|
|
|
306
305
|
test.case("tracks calls", assert => {
|
|
307
|
-
const tracked = spy((a: number, b: number) => a + b);
|
|
306
|
+
const tracked = test.spy((a: number, b: number) => a + b);
|
|
308
307
|
|
|
309
308
|
assert(tracked.called).false();
|
|
310
309
|
assert(tracked.calls).equals([]);
|
|
@@ -321,10 +320,9 @@ Pass a second argument to replace the implementation while still tracking calls:
|
|
|
321
320
|
|
|
322
321
|
```ts
|
|
323
322
|
import test from "@rcompat/test";
|
|
324
|
-
import spy from "@rcompat/spy";
|
|
325
323
|
|
|
326
324
|
test.case("mocks implementation", assert => {
|
|
327
|
-
const tracked = spy(
|
|
325
|
+
const tracked = test.spy(
|
|
328
326
|
(a: number, b: number) => a + b,
|
|
329
327
|
(a: number, b: number) => a * b,
|
|
330
328
|
);
|
|
@@ -510,12 +508,10 @@ asserter.
|
|
|
510
508
|
| --------- | ---------- | --------------------------------------------------------- |
|
|
511
509
|
| `factory` | `function` | Returns extra methods to attach to each `Assert` instance |
|
|
512
510
|
|
|
513
|
-
### `spy`
|
|
511
|
+
### `test.spy`
|
|
514
512
|
|
|
515
513
|
```ts
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
spy<F extends (...args: any[]) => any>(fn: F, mocker?: F): Tracked<F>;
|
|
514
|
+
test.spy<F extends (...args: any[]) => any>(fn: F, mocker?: F): Tracked<F>;
|
|
519
515
|
```
|
|
520
516
|
|
|
521
517
|
Wrap a function to track calls. Returns the wrapped function with two extra
|
package/lib/private/E.d.ts
CHANGED
package/lib/private/extend.d.ts
CHANGED
|
@@ -14,6 +14,6 @@ type Base = {
|
|
|
14
14
|
case(name: string, body: Body): void;
|
|
15
15
|
ended(end: () => MaybePromise<void>): void;
|
|
16
16
|
};
|
|
17
|
-
declare const _default: <Subject, Extensions>(base: Base, factory: Factory<Subject, Extensions>) => ExtendedTest<Extensions>;
|
|
18
17
|
export default _default;
|
|
18
|
+
declare function _default<Subject, Extensions>(base: Base, factory: Factory<Subject, Extensions>): ExtendedTest<Extensions>;
|
|
19
19
|
//# sourceMappingURL=extend.d.ts.map
|
|
@@ -12,6 +12,6 @@ type Intercept = {
|
|
|
12
12
|
restore(): void;
|
|
13
13
|
[Symbol.dispose](): void;
|
|
14
14
|
};
|
|
15
|
-
declare const _default: (base_url: string, setup: (setup: Setup) => void) => Intercept;
|
|
16
15
|
export default _default;
|
|
16
|
+
declare function _default(base_url: string, setup: (setup: Setup) => void): Intercept;
|
|
17
17
|
//# sourceMappingURL=intercept.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { UnknownMap } from "@rcompat/type";
|
|
2
|
-
|
|
2
|
+
export default _default;
|
|
3
|
+
declare function _default(map: UnknownMap): {
|
|
3
4
|
[k: string]: unknown;
|
|
4
5
|
};
|
|
5
|
-
export default _default;
|
|
6
6
|
//# sourceMappingURL=to-object.d.ts.map
|