@genesislcap/foundation-testing 14.1.0 → 14.2.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/dist/dts/utils/harness.d.ts +8 -1
- package/dist/dts/utils/harness.d.ts.map +1 -1
- package/dist/esm/utils/harness.js +10 -1
- package/dist/foundation-testing.api.json +64 -1
- package/dist/foundation-testing.d.ts +9 -1
- package/docs/api/foundation-testing.md +2 -1
- package/docs/api/foundation-testing.resettestharness.md +1 -1
- package/docs/api/foundation-testing.restoretestharness.md +24 -0
- package/docs/api-report.md +3 -0
- package/package.json +3 -3
|
@@ -66,10 +66,17 @@ export type WithTestHarness<T extends {
|
|
|
66
66
|
*/
|
|
67
67
|
export declare function testSpy(constructor: Function): void;
|
|
68
68
|
/**
|
|
69
|
-
* Resets
|
|
69
|
+
* Resets the history of the spied functions on the objects so previous running tests
|
|
70
|
+
* don't affect the current test.
|
|
70
71
|
* Must be called at the end of every test even if not asserting on the spies.
|
|
71
72
|
* @param wrapper - `WithTestHarness<T>` object to reset
|
|
72
73
|
* @public
|
|
73
74
|
*/
|
|
74
75
|
export declare function resetTestHarness<T>(wrapper: WithTestHarness<T>): void;
|
|
76
|
+
/**
|
|
77
|
+
* Restores the spied functions back to the original functions without the spies.
|
|
78
|
+
* @param wrapper - `WithTestHarness<T>` object to restore
|
|
79
|
+
* @public
|
|
80
|
+
*/
|
|
81
|
+
export declare function restoreTestHarness<T>(wrapper: WithTestHarness<T>): void;
|
|
75
82
|
//# sourceMappingURL=harness.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"harness.d.ts","sourceRoot":"","sources":["../../../src/utils/harness.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;;GAGG;AACH,MAAM,MAAM,mBAAmB,CAAC,MAAM,EAAE,SAAS,IAAI,IAAI,CACvD,MAAM,EACN;KAAG,CAAC,IAAI,MAAM,MAAM,GAA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;;GAGG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI,IAAI,CAClC,mBAAmB,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC,EAC/C,aAAa,CACd,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,GAAG;CAAE,IAAI;KAC7E,CAAC,IAAI,MAAM,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CACnE,CAAC;AACF;;;;GAIG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,GAAG;CAAE,IAAI,CAAC,GAChE,YAAY,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;AAYlC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,OAAO,CAAC,WAAW,EAAE,QAAQ,QAK5C;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,OAAO,EAAE,eAAe,CAAC,CAAC,CAAC,QAE9D;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,OAAO,EAAE,eAAe,CAAC,CAAC,CAAC,QAEhE"}
|
|
@@ -45,11 +45,20 @@ export function testSpy(constructor) {
|
|
|
45
45
|
.forEach((p) => constructor['_test'].spy(constructor.prototype, p));
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
48
|
-
* Resets
|
|
48
|
+
* Resets the history of the spied functions on the objects so previous running tests
|
|
49
|
+
* don't affect the current test.
|
|
49
50
|
* Must be called at the end of every test even if not asserting on the spies.
|
|
50
51
|
* @param wrapper - `WithTestHarness<T>` object to reset
|
|
51
52
|
* @public
|
|
52
53
|
*/
|
|
53
54
|
export function resetTestHarness(wrapper) {
|
|
55
|
+
wrapper.constructor['_test'].resetHistory();
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Restores the spied functions back to the original functions without the spies.
|
|
59
|
+
* @param wrapper - `WithTestHarness<T>` object to restore
|
|
60
|
+
* @public
|
|
61
|
+
*/
|
|
62
|
+
export function restoreTestHarness(wrapper) {
|
|
54
63
|
wrapper.constructor['_test'].restore();
|
|
55
64
|
}
|
|
@@ -1465,7 +1465,7 @@
|
|
|
1465
1465
|
{
|
|
1466
1466
|
"kind": "Function",
|
|
1467
1467
|
"canonicalReference": "@genesislcap/foundation-testing!resetTestHarness:function(1)",
|
|
1468
|
-
"docComment": "/**\n * Resets
|
|
1468
|
+
"docComment": "/**\n * Resets the history of the spied functions on the objects so previous running tests don't affect the current test. Must be called at the end of every test even if not asserting on the spies.\n *\n * @param wrapper - `WithTestHarness<T>` object to reset\n *\n * @public\n */\n",
|
|
1469
1469
|
"excerptTokens": [
|
|
1470
1470
|
{
|
|
1471
1471
|
"kind": "Content",
|
|
@@ -1525,6 +1525,69 @@
|
|
|
1525
1525
|
],
|
|
1526
1526
|
"name": "resetTestHarness"
|
|
1527
1527
|
},
|
|
1528
|
+
{
|
|
1529
|
+
"kind": "Function",
|
|
1530
|
+
"canonicalReference": "@genesislcap/foundation-testing!restoreTestHarness:function(1)",
|
|
1531
|
+
"docComment": "/**\n * Restores the spied functions back to the original functions without the spies.\n *\n * @param wrapper - `WithTestHarness<T>` object to restore\n *\n * @public\n */\n",
|
|
1532
|
+
"excerptTokens": [
|
|
1533
|
+
{
|
|
1534
|
+
"kind": "Content",
|
|
1535
|
+
"text": "export declare function restoreTestHarness<T>(wrapper: "
|
|
1536
|
+
},
|
|
1537
|
+
{
|
|
1538
|
+
"kind": "Reference",
|
|
1539
|
+
"text": "WithTestHarness",
|
|
1540
|
+
"canonicalReference": "@genesislcap/foundation-testing!WithTestHarness:type"
|
|
1541
|
+
},
|
|
1542
|
+
{
|
|
1543
|
+
"kind": "Content",
|
|
1544
|
+
"text": "<T>"
|
|
1545
|
+
},
|
|
1546
|
+
{
|
|
1547
|
+
"kind": "Content",
|
|
1548
|
+
"text": "): "
|
|
1549
|
+
},
|
|
1550
|
+
{
|
|
1551
|
+
"kind": "Content",
|
|
1552
|
+
"text": "void"
|
|
1553
|
+
},
|
|
1554
|
+
{
|
|
1555
|
+
"kind": "Content",
|
|
1556
|
+
"text": ";"
|
|
1557
|
+
}
|
|
1558
|
+
],
|
|
1559
|
+
"fileUrlPath": "src/utils/harness.ts",
|
|
1560
|
+
"returnTypeTokenRange": {
|
|
1561
|
+
"startIndex": 4,
|
|
1562
|
+
"endIndex": 5
|
|
1563
|
+
},
|
|
1564
|
+
"releaseTag": "Public",
|
|
1565
|
+
"overloadIndex": 1,
|
|
1566
|
+
"parameters": [
|
|
1567
|
+
{
|
|
1568
|
+
"parameterName": "wrapper",
|
|
1569
|
+
"parameterTypeTokenRange": {
|
|
1570
|
+
"startIndex": 1,
|
|
1571
|
+
"endIndex": 3
|
|
1572
|
+
},
|
|
1573
|
+
"isOptional": false
|
|
1574
|
+
}
|
|
1575
|
+
],
|
|
1576
|
+
"typeParameters": [
|
|
1577
|
+
{
|
|
1578
|
+
"typeParameterName": "T",
|
|
1579
|
+
"constraintTokenRange": {
|
|
1580
|
+
"startIndex": 0,
|
|
1581
|
+
"endIndex": 0
|
|
1582
|
+
},
|
|
1583
|
+
"defaultTypeTokenRange": {
|
|
1584
|
+
"startIndex": 0,
|
|
1585
|
+
"endIndex": 0
|
|
1586
|
+
}
|
|
1587
|
+
}
|
|
1588
|
+
],
|
|
1589
|
+
"name": "restoreTestHarness"
|
|
1590
|
+
},
|
|
1528
1591
|
{
|
|
1529
1592
|
"kind": "Function",
|
|
1530
1593
|
"canonicalReference": "@genesislcap/foundation-testing!runCases:function(1)",
|
|
@@ -273,13 +273,21 @@ export declare interface LogicContext {
|
|
|
273
273
|
export { Registration }
|
|
274
274
|
|
|
275
275
|
/**
|
|
276
|
-
* Resets
|
|
276
|
+
* Resets the history of the spied functions on the objects so previous running tests
|
|
277
|
+
* don't affect the current test.
|
|
277
278
|
* Must be called at the end of every test even if not asserting on the spies.
|
|
278
279
|
* @param wrapper - `WithTestHarness<T>` object to reset
|
|
279
280
|
* @public
|
|
280
281
|
*/
|
|
281
282
|
export declare function resetTestHarness<T>(wrapper: WithTestHarness<T>): void;
|
|
282
283
|
|
|
284
|
+
/**
|
|
285
|
+
* Restores the spied functions back to the original functions without the spies.
|
|
286
|
+
* @param wrapper - `WithTestHarness<T>` object to restore
|
|
287
|
+
* @public
|
|
288
|
+
*/
|
|
289
|
+
export declare function restoreTestHarness<T>(wrapper: WithTestHarness<T>): void;
|
|
290
|
+
|
|
283
291
|
/**
|
|
284
292
|
* @public
|
|
285
293
|
*/
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
| [createComponentSuite(title, elementNameOrGetter, context, registrations)](./foundation-testing.createcomponentsuite.md) | Create component test suite. |
|
|
12
12
|
| [createLogicSuite(title, context)](./foundation-testing.createlogicsuite.md) | Create logic test suite. |
|
|
13
13
|
| [fixture(templateNameOrRegistry, options)](./foundation-testing.fixture.md) | Creates a test fixture suitable for testing custom elements, templates, and bindings. |
|
|
14
|
-
| [resetTestHarness(wrapper)](./foundation-testing.resettestharness.md) | Resets
|
|
14
|
+
| [resetTestHarness(wrapper)](./foundation-testing.resettestharness.md) | Resets the history of the spied functions on the objects so previous running tests don't affect the current test. Must be called at the end of every test even if not asserting on the spies. |
|
|
15
|
+
| [restoreTestHarness(wrapper)](./foundation-testing.restoretestharness.md) | Restores the spied functions back to the original functions without the spies. |
|
|
15
16
|
| [runCases(fn, cases, assertion)](./foundation-testing.runcases.md) | Assert a set of test cases. |
|
|
16
17
|
| [testSpy(constructor)](./foundation-testing.testspy.md) | Decorator: Used on a test harness class based on a <code>FoundationElement</code> to give it extra functionality which can be used during testing. \*Important\* this is to be used on a parent element compared to the element under test. |
|
|
17
18
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## resetTestHarness() function
|
|
6
6
|
|
|
7
|
-
Resets
|
|
7
|
+
Resets the history of the spied functions on the objects so previous running tests don't affect the current test. Must be called at the end of every test even if not asserting on the spies.
|
|
8
8
|
|
|
9
9
|
**Signature:**
|
|
10
10
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/foundation-testing](./foundation-testing.md) > [restoreTestHarness](./foundation-testing.restoretestharness.md)
|
|
4
|
+
|
|
5
|
+
## restoreTestHarness() function
|
|
6
|
+
|
|
7
|
+
Restores the spied functions back to the original functions without the spies.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
export declare function restoreTestHarness<T>(wrapper: WithTestHarness<T>): void;
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
| Parameter | Type | Description |
|
|
18
|
+
| --- | --- | --- |
|
|
19
|
+
| wrapper | [WithTestHarness](./foundation-testing.withtestharness.md)<!-- --><T> | <code>WithTestHarness<T></code> object to restore |
|
|
20
|
+
|
|
21
|
+
**Returns:**
|
|
22
|
+
|
|
23
|
+
void
|
|
24
|
+
|
package/docs/api-report.md
CHANGED
|
@@ -93,6 +93,9 @@ export { Registration }
|
|
|
93
93
|
// @public
|
|
94
94
|
export function resetTestHarness<T>(wrapper: WithTestHarness<T>): void;
|
|
95
95
|
|
|
96
|
+
// @public
|
|
97
|
+
export function restoreTestHarness<T>(wrapper: WithTestHarness<T>): void;
|
|
98
|
+
|
|
96
99
|
// @public (undocumented)
|
|
97
100
|
export type RunCases = (fn: (...args: unknown[]) => unknown, cases: [unknown[], unknown, string?][], assertion?: (...args: unknown[]) => void) => void;
|
|
98
101
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genesislcap/foundation-testing",
|
|
3
3
|
"description": "Genesis Foundation Testing",
|
|
4
|
-
"version": "14.
|
|
4
|
+
"version": "14.2.0",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "SEE LICENSE IN license.txt",
|
|
7
7
|
"main": "dist/esm/index.js",
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
"webpack-merge": "^5.7.3"
|
|
105
105
|
},
|
|
106
106
|
"dependencies": {
|
|
107
|
-
"@genesislcap/foundation-utils": "^14.
|
|
107
|
+
"@genesislcap/foundation-utils": "^14.2.0",
|
|
108
108
|
"@microsoft/fast-element": "^1.7.0",
|
|
109
109
|
"@microsoft/fast-foundation": "^2.33.2",
|
|
110
110
|
"sinon": "15.0.1",
|
|
@@ -114,5 +114,5 @@
|
|
|
114
114
|
"publishConfig": {
|
|
115
115
|
"access": "public"
|
|
116
116
|
},
|
|
117
|
-
"gitHead": "
|
|
117
|
+
"gitHead": "183fc977ed1c952f92922c687c1a033095341bff"
|
|
118
118
|
}
|