html-browser-tester 0.0.10 → 0.0.12

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.
@@ -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;
@@ -1,11 +1,12 @@
1
1
  export declare const assert: (expected: unknown) => {
2
2
  toBe: (resut: unknown) => boolean;
3
- toBeTruthy: (result: unknown) => boolean;
4
- toBeFalsy: (result: unknown) => boolean;
5
- toBeNull: (result: unknown) => boolean;
6
- toBeUndefined: (result: unknown) => boolean;
7
- toBeDefined: (result: unknown) => boolean;
8
- toBeNaN: (result: unknown) => boolean;
3
+ toBeTruthy: () => boolean;
4
+ toBeFalsy: () => boolean;
5
+ toBeNull: () => boolean;
6
+ toBeUndefined: () => boolean;
7
+ toBeDefined: () => boolean;
8
+ toBeNaN: () => boolean;
9
+ toMatch: (result: unknown) => boolean;
9
10
  toContain: (result: unknown) => boolean;
10
11
  toBeLessThan: (result: unknown) => boolean;
11
12
  toBeGreaterThan: (result: unknown) => boolean;
@@ -5,27 +5,35 @@ const assert = (expected) => ({
5
5
  toBe: (resut) => {
6
6
  return expected === resut;
7
7
  },
8
- toBeTruthy: (result) => {
9
- return result === true;
8
+ toBeTruthy: () => {
9
+ return !!expected;
10
10
  },
11
- toBeFalsy: (result) => {
12
- return result === false;
11
+ toBeFalsy: () => {
12
+ return !expected;
13
13
  },
14
- toBeNull: (result) => {
15
- return result === null;
14
+ toBeNull: () => {
15
+ return expected === null;
16
16
  },
17
- toBeUndefined: (result) => {
18
- return result === undefined;
17
+ toBeUndefined: () => {
18
+ return expected === undefined;
19
19
  },
20
- toBeDefined: (result) => {
21
- return result !== undefined;
20
+ toBeDefined: () => {
21
+ return expected !== undefined;
22
22
  },
23
- toBeNaN: (result) => {
24
- return result === NaN;
23
+ toBeNaN: () => {
24
+ return expected === NaN;
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;
25
33
  },
26
34
  toContain: (result) => {
27
35
  if (Array.isArray(expected)) {
28
- expected.some(item => item === result);
36
+ return expected.includes(result);
29
37
  }
30
38
  return false;
31
39
  },
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "html-browser-tester",
3
3
  "main": "./lib/browser-test.js",
4
4
  "types": "./lib/browser-test.d.ts",
5
- "version": "0.0.10",
5
+ "version": "0.0.12",
6
6
  "scripts": {
7
7
  "dev": "vite",
8
8
  "preview": "vite preview",