@clipboard-health/testing-core 0.9.1 → 0.11.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.
- package/README.md +20 -20
- package/package.json +2 -5
package/README.md
CHANGED
|
@@ -34,10 +34,9 @@ const { length } = value;
|
|
|
34
34
|
|
|
35
35
|
This library's helpers narrow types:
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
```ts
|
|
39
|
-
// ./examples/expectToBeDefined.ts
|
|
37
|
+
<embedex source="packages/testing-core/examples/expectToBeDefined.ts">
|
|
40
38
|
|
|
39
|
+
```ts
|
|
41
40
|
import { ok } from "node:assert/strict";
|
|
42
41
|
|
|
43
42
|
import { expectToBeDefined } from "@clipboard-health/testing-core";
|
|
@@ -52,13 +51,13 @@ expectToBeDefined(value);
|
|
|
52
51
|
// Narrowed to `string`
|
|
53
52
|
const { length } = value;
|
|
54
53
|
ok(length === 2);
|
|
55
|
-
|
|
56
54
|
```
|
|
57
55
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
</embedex>
|
|
57
|
+
|
|
58
|
+
<embedex source="packages/testing-core/examples/expectToBeLeft.ts">
|
|
61
59
|
|
|
60
|
+
```ts
|
|
62
61
|
import { ok } from "node:assert/strict";
|
|
63
62
|
|
|
64
63
|
import { expectToBeLeft } from "@clipboard-health/testing-core";
|
|
@@ -77,13 +76,13 @@ expectToBeLeft(value);
|
|
|
77
76
|
|
|
78
77
|
// Narrowed to Left
|
|
79
78
|
ok(value.left === "Cannot divide by zero");
|
|
80
|
-
|
|
81
79
|
```
|
|
82
80
|
|
|
83
|
-
|
|
84
|
-
```ts
|
|
85
|
-
// ./examples/expectToBeRight.ts
|
|
81
|
+
</embedex>
|
|
86
82
|
|
|
83
|
+
<embedex source="packages/testing-core/examples/expectToBeRight.ts">
|
|
84
|
+
|
|
85
|
+
```ts
|
|
87
86
|
import { ok } from "node:assert/strict";
|
|
88
87
|
|
|
89
88
|
import { expectToBeRight } from "@clipboard-health/testing-core";
|
|
@@ -102,13 +101,13 @@ expectToBeRight(value);
|
|
|
102
101
|
|
|
103
102
|
// Narrowed to Right
|
|
104
103
|
ok(value.right === 5);
|
|
105
|
-
|
|
106
104
|
```
|
|
107
105
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
106
|
+
</embedex>
|
|
107
|
+
|
|
108
|
+
<embedex source="packages/testing-core/examples/expectToBeSafeParseError.ts">
|
|
111
109
|
|
|
110
|
+
```ts
|
|
112
111
|
import { ok } from "node:assert/strict";
|
|
113
112
|
|
|
114
113
|
import { expectToBeDefined, expectToBeSafeParseError } from "@clipboard-health/testing-core";
|
|
@@ -125,13 +124,13 @@ expectToBeDefined(firstIssue);
|
|
|
125
124
|
|
|
126
125
|
// Narrowed to `ZodIssue`
|
|
127
126
|
ok(firstIssue.message === "Expected string, received number");
|
|
128
|
-
|
|
129
127
|
```
|
|
130
128
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
129
|
+
</embedex>
|
|
130
|
+
|
|
131
|
+
<embedex source="packages/testing-core/examples/expectToBeSafeParseSuccess.ts">
|
|
134
132
|
|
|
133
|
+
```ts
|
|
135
134
|
import { ok } from "node:assert/strict";
|
|
136
135
|
|
|
137
136
|
import { expectToBeSafeParseSuccess } from "@clipboard-health/testing-core";
|
|
@@ -144,9 +143,10 @@ expectToBeSafeParseSuccess(value);
|
|
|
144
143
|
|
|
145
144
|
// Narrowed to `SafeParseSuccess`
|
|
146
145
|
ok(value.data.name === "hi");
|
|
147
|
-
|
|
148
146
|
```
|
|
149
147
|
|
|
148
|
+
</embedex>
|
|
149
|
+
|
|
150
150
|
## Local development commands
|
|
151
151
|
|
|
152
152
|
See [`package.json`](./package.json) `scripts` for a list of commands.
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clipboard-health/testing-core",
|
|
3
3
|
"description": "TypeScript-friendly testing utilities.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.11.0",
|
|
5
5
|
"bugs": "https://github.com/ClipboardHealth/core-utils/issues",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@clipboard-health/util-ts": "2.
|
|
7
|
+
"@clipboard-health/util-ts": "2.14.0",
|
|
8
8
|
"tslib": "2.8.0",
|
|
9
9
|
"zod": "3.23.8"
|
|
10
10
|
},
|
|
@@ -23,9 +23,6 @@
|
|
|
23
23
|
"type": "git",
|
|
24
24
|
"url": "git+https://github.com/ClipboardHealth/core-utils.git"
|
|
25
25
|
},
|
|
26
|
-
"scripts": {
|
|
27
|
-
"embed": "embedme README.md"
|
|
28
|
-
},
|
|
29
26
|
"type": "commonjs",
|
|
30
27
|
"typings": "./src/index.d.ts",
|
|
31
28
|
"types": "./src/index.d.ts"
|