@clipboard-health/testing-core 0.10.0 → 0.11.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 +20 -15
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -34,9 +34,9 @@ const { length } = value;
|
|
|
34
34
|
|
|
35
35
|
This library's helpers narrow types:
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
<embedex source="packages/testing-core/examples/expectToBeDefined.ts">
|
|
38
|
+
|
|
38
39
|
```ts
|
|
39
|
-
// packages/testing-core/examples/expectToBeDefined.ts
|
|
40
40
|
import { ok } from "node:assert/strict";
|
|
41
41
|
|
|
42
42
|
import { expectToBeDefined } from "@clipboard-health/testing-core";
|
|
@@ -51,12 +51,13 @@ expectToBeDefined(value);
|
|
|
51
51
|
// Narrowed to `string`
|
|
52
52
|
const { length } = value;
|
|
53
53
|
ok(length === 2);
|
|
54
|
-
|
|
55
54
|
```
|
|
56
55
|
|
|
57
|
-
|
|
56
|
+
</embedex>
|
|
57
|
+
|
|
58
|
+
<embedex source="packages/testing-core/examples/expectToBeLeft.ts">
|
|
59
|
+
|
|
58
60
|
```ts
|
|
59
|
-
// packages/testing-core/examples/expectToBeLeft.ts
|
|
60
61
|
import { ok } from "node:assert/strict";
|
|
61
62
|
|
|
62
63
|
import { expectToBeLeft } from "@clipboard-health/testing-core";
|
|
@@ -75,12 +76,13 @@ expectToBeLeft(value);
|
|
|
75
76
|
|
|
76
77
|
// Narrowed to Left
|
|
77
78
|
ok(value.left === "Cannot divide by zero");
|
|
78
|
-
|
|
79
79
|
```
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
</embedex>
|
|
82
|
+
|
|
83
|
+
<embedex source="packages/testing-core/examples/expectToBeRight.ts">
|
|
84
|
+
|
|
82
85
|
```ts
|
|
83
|
-
// packages/testing-core/examples/expectToBeRight.ts
|
|
84
86
|
import { ok } from "node:assert/strict";
|
|
85
87
|
|
|
86
88
|
import { expectToBeRight } from "@clipboard-health/testing-core";
|
|
@@ -99,12 +101,13 @@ expectToBeRight(value);
|
|
|
99
101
|
|
|
100
102
|
// Narrowed to Right
|
|
101
103
|
ok(value.right === 5);
|
|
102
|
-
|
|
103
104
|
```
|
|
104
105
|
|
|
105
|
-
|
|
106
|
+
</embedex>
|
|
107
|
+
|
|
108
|
+
<embedex source="packages/testing-core/examples/expectToBeSafeParseError.ts">
|
|
109
|
+
|
|
106
110
|
```ts
|
|
107
|
-
// packages/testing-core/examples/expectToBeSafeParseError.ts
|
|
108
111
|
import { ok } from "node:assert/strict";
|
|
109
112
|
|
|
110
113
|
import { expectToBeDefined, expectToBeSafeParseError } from "@clipboard-health/testing-core";
|
|
@@ -121,12 +124,13 @@ expectToBeDefined(firstIssue);
|
|
|
121
124
|
|
|
122
125
|
// Narrowed to `ZodIssue`
|
|
123
126
|
ok(firstIssue.message === "Expected string, received number");
|
|
124
|
-
|
|
125
127
|
```
|
|
126
128
|
|
|
127
|
-
|
|
129
|
+
</embedex>
|
|
130
|
+
|
|
131
|
+
<embedex source="packages/testing-core/examples/expectToBeSafeParseSuccess.ts">
|
|
132
|
+
|
|
128
133
|
```ts
|
|
129
|
-
// packages/testing-core/examples/expectToBeSafeParseSuccess.ts
|
|
130
134
|
import { ok } from "node:assert/strict";
|
|
131
135
|
|
|
132
136
|
import { expectToBeSafeParseSuccess } from "@clipboard-health/testing-core";
|
|
@@ -139,9 +143,10 @@ expectToBeSafeParseSuccess(value);
|
|
|
139
143
|
|
|
140
144
|
// Narrowed to `SafeParseSuccess`
|
|
141
145
|
ok(value.data.name === "hi");
|
|
142
|
-
|
|
143
146
|
```
|
|
144
147
|
|
|
148
|
+
</embedex>
|
|
149
|
+
|
|
145
150
|
## Local development commands
|
|
146
151
|
|
|
147
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.1",
|
|
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.1",
|
|
8
8
|
"tslib": "2.8.0",
|
|
9
9
|
"zod": "3.23.8"
|
|
10
10
|
},
|