html-browser-tester 0.0.10 → 0.0.11
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/lib/browser-test.d.ts +2 -0
- package/lib/expect/assert.d.ts +1 -0
- package/lib/expect/assert.js +11 -3
- package/package.json +1 -1
package/lib/browser-test.d.ts
CHANGED
@@ -30,6 +30,7 @@ export declare class BrowserTester {
|
|
30
30
|
toBeUndefined: (value: unknown) => void;
|
31
31
|
toBeDefined: (value: unknown) => void;
|
32
32
|
toBeNaN: (value: unknown) => void;
|
33
|
+
toMatch: (value: unknown) => void;
|
33
34
|
toContain: (value: unknown) => void;
|
34
35
|
toBeLessThan: (value: unknown) => void;
|
35
36
|
toBeGreaterThan: (value: unknown) => void;
|
@@ -45,6 +46,7 @@ export declare class BrowserTester {
|
|
45
46
|
toBeUndefined: (value: unknown) => void;
|
46
47
|
toBeDefined: (value: unknown) => void;
|
47
48
|
toBeNaN: (value: unknown) => void;
|
49
|
+
toMatch: (value: unknown) => void;
|
48
50
|
toContain: (value: unknown) => void;
|
49
51
|
toBeLessThan: (value: unknown) => void;
|
50
52
|
toBeGreaterThan: (value: unknown) => void;
|
package/lib/expect/assert.d.ts
CHANGED
@@ -6,6 +6,7 @@ export declare const assert: (expected: unknown) => {
|
|
6
6
|
toBeUndefined: (result: unknown) => boolean;
|
7
7
|
toBeDefined: (result: unknown) => boolean;
|
8
8
|
toBeNaN: (result: unknown) => boolean;
|
9
|
+
toMatch: (result: unknown) => boolean;
|
9
10
|
toContain: (result: unknown) => boolean;
|
10
11
|
toBeLessThan: (result: unknown) => boolean;
|
11
12
|
toBeGreaterThan: (result: unknown) => boolean;
|
package/lib/expect/assert.js
CHANGED
@@ -6,10 +6,10 @@ const assert = (expected) => ({
|
|
6
6
|
return expected === resut;
|
7
7
|
},
|
8
8
|
toBeTruthy: (result) => {
|
9
|
-
return result
|
9
|
+
return !!result;
|
10
10
|
},
|
11
11
|
toBeFalsy: (result) => {
|
12
|
-
return result
|
12
|
+
return !result;
|
13
13
|
},
|
14
14
|
toBeNull: (result) => {
|
15
15
|
return result === null;
|
@@ -23,9 +23,17 @@ const assert = (expected) => ({
|
|
23
23
|
toBeNaN: (result) => {
|
24
24
|
return result === NaN;
|
25
25
|
},
|
26
|
+
toMatch: (result) => {
|
27
|
+
if (typeof expected === 'string' && typeof result === 'string') {
|
28
|
+
if (expected.indexOf(result) !== -1) {
|
29
|
+
return true;
|
30
|
+
}
|
31
|
+
}
|
32
|
+
return false;
|
33
|
+
},
|
26
34
|
toContain: (result) => {
|
27
35
|
if (Array.isArray(expected)) {
|
28
|
-
expected.
|
36
|
+
return expected.includes(result);
|
29
37
|
}
|
30
38
|
return false;
|
31
39
|
},
|