@digitaldefiance/express-suite-test-utils 1.0.5 → 1.0.7
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 +31 -0
- package/package.json +1 -1
- package/src/index.d.ts +1 -0
- package/src/index.d.ts.map +1 -1
- package/src/index.js +1 -0
- package/src/lib/react-mocks.d.ts +20 -0
- package/src/lib/react-mocks.d.ts.map +1 -0
- package/src/lib/react-mocks.js +30 -0
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Test utilities for Digital Defiance Express Suite projects.
|
|
4
4
|
|
|
5
|
+
Part of [Express Suite](https://github.com/Digital-Defiance/express-suite)
|
|
6
|
+
|
|
5
7
|
## Installation
|
|
6
8
|
|
|
7
9
|
```bash
|
|
@@ -12,6 +14,31 @@ yarn add @digitaldefiance/express-suite-test-utils
|
|
|
12
14
|
|
|
13
15
|
## Usage
|
|
14
16
|
|
|
17
|
+
### Importing Test Utilities from node-express-suite
|
|
18
|
+
|
|
19
|
+
Test helpers and mocks from `@digitaldefiance/node-express-suite` are available via a separate entry point:
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
import {
|
|
23
|
+
mockFunctions,
|
|
24
|
+
setupTestEnv,
|
|
25
|
+
// ... other test helpers
|
|
26
|
+
} from '@digitaldefiance/node-express-suite/testing';
|
|
27
|
+
|
|
28
|
+
// Use in your tests
|
|
29
|
+
beforeAll(async () => {
|
|
30
|
+
await setupTestEnv();
|
|
31
|
+
});
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**Note:** These utilities require `@faker-js/faker` as a peer dependency:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm install -D @faker-js/faker
|
|
38
|
+
# or
|
|
39
|
+
yarn add -D @faker-js/faker
|
|
40
|
+
```
|
|
41
|
+
|
|
15
42
|
### toThrowType Matcher
|
|
16
43
|
|
|
17
44
|
Custom Jest matcher for testing error types with optional validation:
|
|
@@ -70,6 +97,10 @@ MIT
|
|
|
70
97
|
|
|
71
98
|
## ChangeLog
|
|
72
99
|
|
|
100
|
+
### v1.0.6
|
|
101
|
+
|
|
102
|
+
- Add react mocks
|
|
103
|
+
|
|
73
104
|
### v1.0.5
|
|
74
105
|
|
|
75
106
|
- Add secp256k to BSON mock
|
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
package/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/digitaldefiance-express-suite-test-utils/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/digitaldefiance-express-suite-test-utils/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC"}
|
package/src/index.js
CHANGED
|
@@ -5,3 +5,4 @@ tslib_1.__exportStar(require("./lib/to-throw-type"), exports);
|
|
|
5
5
|
tslib_1.__exportStar(require("./lib/console"), exports);
|
|
6
6
|
tslib_1.__exportStar(require("./lib/localStorage-mock"), exports);
|
|
7
7
|
tslib_1.__exportStar(require("./lib/bson-mock"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./lib/react-mocks"), exports);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mock utilities for React component testing
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Mock timezones for testing
|
|
6
|
+
*/
|
|
7
|
+
export declare const mockTimezones: string[];
|
|
8
|
+
/**
|
|
9
|
+
* Get initial timezone mock
|
|
10
|
+
*/
|
|
11
|
+
export declare const mockGetInitialTimezone: () => string;
|
|
12
|
+
/**
|
|
13
|
+
* Mock RegisterForm props
|
|
14
|
+
*/
|
|
15
|
+
export declare const mockRegisterFormProps: {
|
|
16
|
+
timezones: string[];
|
|
17
|
+
getInitialTimezone: () => string;
|
|
18
|
+
onSubmit: jest.Mock<any, any, any>;
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=react-mocks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-mocks.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-test-utils/src/lib/react-mocks.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,eAAO,MAAM,aAAa,UAOzB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB,QAAO,MAAe,CAAC;AAE1D;;GAEG;AACH,eAAO,MAAM,qBAAqB;;8BALQ,MAAM;;CAS/C,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Mock utilities for React component testing
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.mockRegisterFormProps = exports.mockGetInitialTimezone = exports.mockTimezones = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Mock timezones for testing
|
|
9
|
+
*/
|
|
10
|
+
exports.mockTimezones = [
|
|
11
|
+
'America/New_York',
|
|
12
|
+
'America/Los_Angeles',
|
|
13
|
+
'Europe/London',
|
|
14
|
+
'Europe/Paris',
|
|
15
|
+
'Asia/Tokyo',
|
|
16
|
+
'UTC',
|
|
17
|
+
];
|
|
18
|
+
/**
|
|
19
|
+
* Get initial timezone mock
|
|
20
|
+
*/
|
|
21
|
+
const mockGetInitialTimezone = () => 'UTC';
|
|
22
|
+
exports.mockGetInitialTimezone = mockGetInitialTimezone;
|
|
23
|
+
/**
|
|
24
|
+
* Mock RegisterForm props
|
|
25
|
+
*/
|
|
26
|
+
exports.mockRegisterFormProps = {
|
|
27
|
+
timezones: exports.mockTimezones,
|
|
28
|
+
getInitialTimezone: exports.mockGetInitialTimezone,
|
|
29
|
+
onSubmit: jest.fn().mockResolvedValue({ success: true, message: 'Success' }),
|
|
30
|
+
};
|