@dreamboard-games/testing 0.1.2 → 0.1.3
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/dist/index.d.ts +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/create-expect-api.test.ts +8 -0
- package/src/create-expect-api.ts +8 -0
- package/src/definitions.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dreamboard-games/testing",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Dreamboard authored testing helpers and reducer-native UI test runtime",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@dreamboard/api-client": "npm:@dreamboard-games/api-client@0.1.2",
|
|
29
|
-
"@dreamboard/app-sdk": "npm:@dreamboard-games/app-sdk@0.0.
|
|
29
|
+
"@dreamboard/app-sdk": "npm:@dreamboard-games/app-sdk@0.0.45",
|
|
30
30
|
"@dreamboard/reducer-contract": "npm:@dreamboard-games/reducer-contract@7.0.2",
|
|
31
|
-
"@dreamboard/ui-sdk": "npm:@dreamboard-games/ui-sdk@0.0.
|
|
31
|
+
"@dreamboard/ui-sdk": "npm:@dreamboard-games/ui-sdk@0.0.46",
|
|
32
32
|
"zustand": "^5.0.4"
|
|
33
33
|
},
|
|
34
34
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -75,6 +75,14 @@ describe("createExpectApi — value matchers", () => {
|
|
|
75
75
|
).toThrow();
|
|
76
76
|
});
|
|
77
77
|
|
|
78
|
+
test("toBeGreaterThan checks numeric ordering", () => {
|
|
79
|
+
expectFn(6).toBeGreaterThan(5);
|
|
80
|
+
expect(() => expectFn(5).toBeGreaterThan(5)).toThrow();
|
|
81
|
+
expect(() =>
|
|
82
|
+
expectFn("five" as unknown).toBeGreaterThan(1),
|
|
83
|
+
).toThrow();
|
|
84
|
+
});
|
|
85
|
+
|
|
78
86
|
test("toThrow with predicate variants", () => {
|
|
79
87
|
expectFn(() => {
|
|
80
88
|
throw new Error("boom");
|
package/src/create-expect-api.ts
CHANGED
|
@@ -236,6 +236,14 @@ export function createExpectApi(
|
|
|
236
236
|
toHaveLength: (expected: number) => {
|
|
237
237
|
assertLength(actual, expected);
|
|
238
238
|
},
|
|
239
|
+
toBeGreaterThan: (expected: number) => {
|
|
240
|
+
if (typeof actual !== "number") {
|
|
241
|
+
throw new Error("toBeGreaterThan expects a number actual value.");
|
|
242
|
+
}
|
|
243
|
+
if (actual <= expected) {
|
|
244
|
+
throw new Error(`Expected ${actual} to be > ${expected}.`);
|
|
245
|
+
}
|
|
246
|
+
},
|
|
239
247
|
toBeGreaterThanOrEqual: (expected: number) => {
|
|
240
248
|
if (typeof actual !== "number") {
|
|
241
249
|
throw new Error(
|
package/src/definitions.ts
CHANGED
|
@@ -31,6 +31,7 @@ export type ExpectMatchers = {
|
|
|
31
31
|
toContain: (expected: unknown) => void;
|
|
32
32
|
toContainEqual: (expected: unknown) => void;
|
|
33
33
|
toHaveLength: (expected: number) => void;
|
|
34
|
+
toBeGreaterThan: (expected: number) => void;
|
|
34
35
|
toBeGreaterThanOrEqual: (expected: number) => void;
|
|
35
36
|
toThrow: (predicate?: string | RegExp | ((error: Error) => boolean)) => void;
|
|
36
37
|
toMatchSnapshot: (filename?: string) => void;
|