@clipboard-health/testing-core 0.1.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 ADDED
@@ -0,0 +1,21 @@
1
+ # @clipboard-health/testing-core <!-- omit from toc -->
2
+
3
+ Core utilities for testing Clipboard Health's software.
4
+
5
+ ## Table of contents <!-- omit from toc -->
6
+
7
+ - [Install](#install)
8
+ - [Usage](#usage)
9
+ - [Local development commands](#local-development-commands)
10
+
11
+ ## Install
12
+
13
+ ```bash
14
+ npm install @clipboard-health/testing-core
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ ## Local development commands
20
+
21
+ See [`package.json`](./package.json) `scripts` for a list of commands.
package/package.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "@clipboard-health/testing-core",
3
+ "description": "Core utilities for testing Clipboard Health's software.",
4
+ "version": "0.1.0",
5
+ "dependencies": {
6
+ "tslib": "2.8.0",
7
+ "zod": "3.23.8"
8
+ },
9
+ "keywords": [],
10
+ "license": "MIT",
11
+ "main": "./src/index.js",
12
+ "publishConfig": {
13
+ "access": "public"
14
+ },
15
+ "type": "commonjs",
16
+ "typings": "./src/index.d.ts",
17
+ "types": "./src/index.d.ts"
18
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export * from "./lib/expectToBeDefined";
2
+ export * from "./lib/expectToBeSafeParseError";
3
+ export * from "./lib/expectToBeSafeParseSuccess";
package/src/index.js ADDED
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./lib/expectToBeDefined"), exports);
5
+ tslib_1.__exportStar(require("./lib/expectToBeSafeParseError"), exports);
6
+ tslib_1.__exportStar(require("./lib/expectToBeSafeParseSuccess"), exports);
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/testing-core/src/index.ts"],"names":[],"mappings":";;;AAAA,kEAAwC;AACxC,yEAA+C;AAC/C,2EAAiD"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Asserts and narrows the type for defined values.
3
+ *
4
+ * @throws {AssertionError} for null or undefined values.
5
+ */
6
+ export declare function expectToBeDefined<T>(value: T | undefined): asserts value is T;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.expectToBeDefined = expectToBeDefined;
4
+ const node_assert_1 = require("node:assert");
5
+ /**
6
+ * Asserts and narrows the type for defined values.
7
+ *
8
+ * @throws {AssertionError} for null or undefined values.
9
+ */
10
+ function expectToBeDefined(value) {
11
+ (0, node_assert_1.ok)(value !== undefined && value !== null, "Expected value to be defined, got null or undefined");
12
+ }
13
+ //# sourceMappingURL=expectToBeDefined.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expectToBeDefined.js","sourceRoot":"","sources":["../../../../../packages/testing-core/src/lib/expectToBeDefined.ts"],"names":[],"mappings":";;AAOA,8CAEC;AATD,6CAAiC;AAEjC;;;;GAIG;AACH,SAAgB,iBAAiB,CAAI,KAAoB;IACvD,IAAA,gBAAE,EAAC,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE,qDAAqD,CAAC,CAAC;AACnG,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { type SafeParseError, type SafeParseReturnType } from "zod";
2
+ /**
3
+ * Asserts and narrows the type for Zod SafeParseReturnType to a SafeParseError.
4
+ *
5
+ * @throws {AssertionError} for SafeParseSuccess.
6
+ */
7
+ export declare function expectToBeSafeParseError<Input, Output>(value: Readonly<SafeParseReturnType<Input, Output>>): asserts value is SafeParseError<Input>;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.expectToBeSafeParseError = expectToBeSafeParseError;
4
+ const node_assert_1 = require("node:assert");
5
+ const expectToBeDefined_1 = require("./expectToBeDefined");
6
+ /**
7
+ * Asserts and narrows the type for Zod SafeParseReturnType to a SafeParseError.
8
+ *
9
+ * @throws {AssertionError} for SafeParseSuccess.
10
+ */
11
+ function expectToBeSafeParseError(value) {
12
+ (0, expectToBeDefined_1.expectToBeDefined)(value);
13
+ (0, node_assert_1.ok)(!value.success, "Expected SafeParseError, got SafeParseSuccess");
14
+ }
15
+ //# sourceMappingURL=expectToBeSafeParseError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expectToBeSafeParseError.js","sourceRoot":"","sources":["../../../../../packages/testing-core/src/lib/expectToBeSafeParseError.ts"],"names":[],"mappings":";;AAWA,4DAKC;AAhBD,6CAAiC;AAIjC,2DAAwD;AAExD;;;;GAIG;AACH,SAAgB,wBAAwB,CACtC,KAAmD;IAEnD,IAAA,qCAAiB,EAAC,KAAK,CAAC,CAAC;IACzB,IAAA,gBAAE,EAAC,CAAC,KAAK,CAAC,OAAO,EAAE,+CAA+C,CAAC,CAAC;AACtE,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { type SafeParseReturnType, type SafeParseSuccess } from "zod";
2
+ /**
3
+ * Asserts and narrows the type for Zod SafeParseReturnType to a SafeParseSuccess.
4
+ *
5
+ * @throws {AssertionError} for SafeParseError.
6
+ */
7
+ export declare function expectToBeSafeParseSuccess<Input, Output>(value: Readonly<SafeParseReturnType<Input, Output>>): asserts value is SafeParseSuccess<Output>;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.expectToBeSafeParseSuccess = expectToBeSafeParseSuccess;
4
+ const node_assert_1 = require("node:assert");
5
+ const expectToBeDefined_1 = require("./expectToBeDefined");
6
+ /**
7
+ * Asserts and narrows the type for Zod SafeParseReturnType to a SafeParseSuccess.
8
+ *
9
+ * @throws {AssertionError} for SafeParseError.
10
+ */
11
+ function expectToBeSafeParseSuccess(value) {
12
+ (0, expectToBeDefined_1.expectToBeDefined)(value);
13
+ (0, node_assert_1.ok)(value.success, "Expected SafeParseSuccess, got SafeParseError");
14
+ }
15
+ //# sourceMappingURL=expectToBeSafeParseSuccess.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expectToBeSafeParseSuccess.js","sourceRoot":"","sources":["../../../../../packages/testing-core/src/lib/expectToBeSafeParseSuccess.ts"],"names":[],"mappings":";;AAWA,gEAKC;AAhBD,6CAAiC;AAIjC,2DAAwD;AAExD;;;;GAIG;AACH,SAAgB,0BAA0B,CACxC,KAAmD;IAEnD,IAAA,qCAAiB,EAAC,KAAK,CAAC,CAAC;IACzB,IAAA,gBAAE,EAAC,KAAK,CAAC,OAAO,EAAE,+CAA+C,CAAC,CAAC;AACrE,CAAC"}