@genesislcap/foundation-testing 14.408.0 → 14.409.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/README.md +5 -278
- package/package.json +5 -6
- package/docs/api/foundation-testing.componentcontext.container.md +0 -11
- package/docs/api/foundation-testing.componentcontext.designsystem.md +0 -11
- package/docs/api/foundation-testing.componentcontext.md +0 -91
- package/docs/api/foundation-testing.componentcontext.runcases.md +0 -11
- package/docs/api/foundation-testing.createcomponentsuite.md +0 -168
- package/docs/api/foundation-testing.createlogicsuite.md +0 -99
- package/docs/api/foundation-testing.delayedresolve.md +0 -80
- package/docs/api/foundation-testing.elementgetter.md +0 -12
- package/docs/api/foundation-testing.equal.md +0 -13
- package/docs/api/foundation-testing.expect.md +0 -13
- package/docs/api/foundation-testing.filterconditionally.md +0 -15
- package/docs/api/foundation-testing.fixture.connect.md +0 -21
- package/docs/api/foundation-testing.fixture.disconnect.md +0 -21
- package/docs/api/foundation-testing.fixture.document.md +0 -13
- package/docs/api/foundation-testing.fixture.element.md +0 -13
- package/docs/api/foundation-testing.fixture.md +0 -171
- package/docs/api/foundation-testing.fixture.parent.md +0 -18
- package/docs/api/foundation-testing.fixture.template.md +0 -13
- package/docs/api/foundation-testing.fixture.view.md +0 -13
- package/docs/api/foundation-testing.fixtureoptions.context.md +0 -13
- package/docs/api/foundation-testing.fixtureoptions.designsystem.md +0 -13
- package/docs/api/foundation-testing.fixtureoptions.document.md +0 -13
- package/docs/api/foundation-testing.fixtureoptions.md +0 -134
- package/docs/api/foundation-testing.fixtureoptions.parent.md +0 -13
- package/docs/api/foundation-testing.fixtureoptions.source.md +0 -13
- package/docs/api/foundation-testing.logger.md +0 -18
- package/docs/api/foundation-testing.logiccontext.md +0 -40
- package/docs/api/foundation-testing.logiccontext.runcases.md +0 -64
- package/docs/api/foundation-testing.md +0 -317
- package/docs/api/foundation-testing.resettestharness.md +0 -54
- package/docs/api/foundation-testing.restoretestharness.md +0 -54
- package/docs/api/foundation-testing.runcases.md +0 -12
- package/docs/api/foundation-testing.sinonwrapper.md +0 -17
- package/docs/api/foundation-testing.spiedfunctions.md +0 -15
- package/docs/api/foundation-testing.suitecallback.md +0 -15
- package/docs/api/foundation-testing.testspy.md +0 -66
- package/docs/api/foundation-testing.timeout.md +0 -99
- package/docs/api/foundation-testing.withtestharness.md +0 -17
- package/docs/api/index.md +0 -30
- package/docs/api-report.md.api.md +0 -143
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@genesislcap/foundation-testing](./foundation-testing.md) > [timeout](./foundation-testing.timeout.md)
|
|
4
|
-
|
|
5
|
-
## timeout() function
|
|
6
|
-
|
|
7
|
-
Timeout utility.
|
|
8
|
-
|
|
9
|
-
**Signature:**
|
|
10
|
-
|
|
11
|
-
```typescript
|
|
12
|
-
timeout: (callback: (context: any) => Promise<any>, duration?: number) => (context: any) => Promise<any>
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## Parameters
|
|
16
|
-
|
|
17
|
-
<table><thead><tr><th>
|
|
18
|
-
|
|
19
|
-
Parameter
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
</th><th>
|
|
23
|
-
|
|
24
|
-
Type
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
</th><th>
|
|
28
|
-
|
|
29
|
-
Description
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
</th></tr></thead>
|
|
33
|
-
<tbody><tr><td>
|
|
34
|
-
|
|
35
|
-
callback
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
</td><td>
|
|
39
|
-
|
|
40
|
-
(context: any) => Promise<any>
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
</td><td>
|
|
44
|
-
|
|
45
|
-
The async test function.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
</td></tr>
|
|
49
|
-
<tr><td>
|
|
50
|
-
|
|
51
|
-
duration
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
</td><td>
|
|
55
|
-
|
|
56
|
-
number
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
</td><td>
|
|
60
|
-
|
|
61
|
-
_(Optional)_ An optional duration in milliseconds. Defaults to 5\_000.
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
</td></tr>
|
|
65
|
-
</tbody></table>
|
|
66
|
-
|
|
67
|
-
**Returns:**
|
|
68
|
-
|
|
69
|
-
(context: any) => Promise<any>
|
|
70
|
-
|
|
71
|
-
## Example 1
|
|
72
|
-
|
|
73
|
-
A promise that never ends.
|
|
74
|
-
|
|
75
|
-
```ts
|
|
76
|
-
test(
|
|
77
|
-
'should fail',
|
|
78
|
-
timeout(async () => {
|
|
79
|
-
await new Promise(() => {});
|
|
80
|
-
assert.ok(true);
|
|
81
|
-
}, 5_000),
|
|
82
|
-
);
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
## Example 2
|
|
86
|
-
|
|
87
|
-
A slow API.
|
|
88
|
-
|
|
89
|
-
```ts
|
|
90
|
-
test(
|
|
91
|
-
'should fail',
|
|
92
|
-
timeout(async () => {
|
|
93
|
-
const slowMockAPI = delayedResolve({ foo: 'bar' }, 4_000);
|
|
94
|
-
await slowMockAPI();
|
|
95
|
-
assert.unreachable('should have timed out');
|
|
96
|
-
}, 2_000),
|
|
97
|
-
);
|
|
98
|
-
```
|
|
99
|
-
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@genesislcap/foundation-testing](./foundation-testing.md) > [WithTestHarness](./foundation-testing.withtestharness.md)
|
|
4
|
-
|
|
5
|
-
## WithTestHarness type
|
|
6
|
-
|
|
7
|
-
Type can be used to inform Typescript the object decorated with [testSpy()](./foundation-testing.testspy.md) has function spies which can be interacted upon their normal function reference
|
|
8
|
-
|
|
9
|
-
**Signature:**
|
|
10
|
-
|
|
11
|
-
```typescript
|
|
12
|
-
export type WithTestHarness<T extends {
|
|
13
|
-
[k in keyof T]: any;
|
|
14
|
-
}> = T & SinonWrapper<SpiedFunctions<T>>;
|
|
15
|
-
```
|
|
16
|
-
**References:** [SinonWrapper](./foundation-testing.sinonwrapper.md)<!-- -->, [SpiedFunctions](./foundation-testing.spiedfunctions.md)
|
|
17
|
-
|
package/docs/api/index.md
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md)
|
|
4
|
-
|
|
5
|
-
## API Reference
|
|
6
|
-
|
|
7
|
-
## Packages
|
|
8
|
-
|
|
9
|
-
<table><thead><tr><th>
|
|
10
|
-
|
|
11
|
-
Package
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
</th><th>
|
|
15
|
-
|
|
16
|
-
Description
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
</th></tr></thead>
|
|
20
|
-
<tbody><tr><td>
|
|
21
|
-
|
|
22
|
-
[@genesislcap/foundation-testing](./foundation-testing.md)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
</td><td>
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
</td></tr>
|
|
29
|
-
</tbody></table>
|
|
30
|
-
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
## API Report File for "@genesislcap/foundation-testing"
|
|
2
|
-
|
|
3
|
-
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
-
|
|
5
|
-
```ts
|
|
6
|
-
|
|
7
|
-
import * as assert from 'uvu/assert';
|
|
8
|
-
import { Constructable } from '@microsoft/fast-element';
|
|
9
|
-
import { Container } from '@microsoft/fast-foundation';
|
|
10
|
-
import { DesignSystem } from '@microsoft/fast-foundation';
|
|
11
|
-
import { ExecutionContext } from '@microsoft/fast-element';
|
|
12
|
-
import type { FoundationElement } from '@microsoft/fast-foundation';
|
|
13
|
-
import { FoundationElementDefinition } from '@microsoft/fast-foundation';
|
|
14
|
-
import { FoundationElementRegistry } from '@microsoft/fast-foundation';
|
|
15
|
-
import { HTMLView } from '@microsoft/fast-element';
|
|
16
|
-
import { Logger } from '@genesislcap/foundation-logger';
|
|
17
|
-
import { Registration } from '@microsoft/fast-foundation';
|
|
18
|
-
import { default as sinon_2 } from 'sinon';
|
|
19
|
-
import { default as sinon_3 } from 'sinon';
|
|
20
|
-
import { suite } from 'uvu';
|
|
21
|
-
import { test as test_2 } from 'uvu';
|
|
22
|
-
import { uvu } from 'uvu';
|
|
23
|
-
import { ViewTemplate } from '@microsoft/fast-element';
|
|
24
|
-
|
|
25
|
-
export { assert }
|
|
26
|
-
|
|
27
|
-
// @public
|
|
28
|
-
export interface ComponentContext<TElement = HTMLElement> extends Pick<Fixture<TElement>, 'element' | 'disconnect'> {
|
|
29
|
-
// (undocumented)
|
|
30
|
-
container: Container;
|
|
31
|
-
// (undocumented)
|
|
32
|
-
designSystem: DesignSystem;
|
|
33
|
-
// (undocumented)
|
|
34
|
-
runCases: RunCases;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// @public
|
|
38
|
-
export function createComponentSuite<TElement = HTMLElement>(title: string, elementNameOrGetter: string | ElementGetter, context?: ComponentContext<TElement>, registrations?: Registration<any>[]): uvu.Test<ComponentContext<TElement>>;
|
|
39
|
-
|
|
40
|
-
// @public
|
|
41
|
-
export function createLogicSuite<TContext = LogicContext>(title: string, context?: TContext): uvu.Test<TContext>;
|
|
42
|
-
|
|
43
|
-
// @public
|
|
44
|
-
export const delayedResolve: (result: unknown, duration?: number) => () => Promise<unknown>;
|
|
45
|
-
|
|
46
|
-
// @public (undocumented)
|
|
47
|
-
export type ElementGetter = () => FoundationElementRegistry<FoundationElementDefinition, FoundationElement>;
|
|
48
|
-
|
|
49
|
-
// @public
|
|
50
|
-
export type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false;
|
|
51
|
-
|
|
52
|
-
// @public
|
|
53
|
-
export type Expect<T extends true> = T;
|
|
54
|
-
|
|
55
|
-
// @public
|
|
56
|
-
export type FilterConditionally<Source, Condition> = Pick<Source, {
|
|
57
|
-
[K in keyof Source]: Source[K] extends Condition ? K : never;
|
|
58
|
-
}[keyof Source]>;
|
|
59
|
-
|
|
60
|
-
// @public
|
|
61
|
-
export interface Fixture<TElement = HTMLElement> {
|
|
62
|
-
connect(): Promise<void>;
|
|
63
|
-
disconnect(): Promise<void>;
|
|
64
|
-
document: Document;
|
|
65
|
-
element: TElement;
|
|
66
|
-
parent: HTMLElement;
|
|
67
|
-
template: ViewTemplate;
|
|
68
|
-
view: HTMLView;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// @public
|
|
72
|
-
export function fixture<TElement = HTMLElement>(templateNameOrRegistry: ViewTemplate | string | FoundationElementRegistry<FoundationElementDefinition, Constructable<TElement>> | [
|
|
73
|
-
FoundationElementRegistry<FoundationElementDefinition, Constructable<TElement>>,
|
|
74
|
-
...FoundationElementRegistry<FoundationElementDefinition, Constructable>[]
|
|
75
|
-
], options?: FixtureOptions): Promise<Fixture<TElement>>;
|
|
76
|
-
|
|
77
|
-
// @public
|
|
78
|
-
export interface FixtureOptions {
|
|
79
|
-
context?: ExecutionContext;
|
|
80
|
-
designSystem?: DesignSystem;
|
|
81
|
-
document?: Document;
|
|
82
|
-
parent?: HTMLElement;
|
|
83
|
-
source?: any;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// @public
|
|
87
|
-
export const logger: Logger;
|
|
88
|
-
|
|
89
|
-
// @public
|
|
90
|
-
export interface LogicContext {
|
|
91
|
-
// (undocumented)
|
|
92
|
-
runCases?(fn: (value: any) => any, cases: [any, any, assert.Message?][]): void;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export { Registration }
|
|
96
|
-
|
|
97
|
-
// @public
|
|
98
|
-
export function resetTestHarness<T>(wrapper: WithTestHarness<T>): void;
|
|
99
|
-
|
|
100
|
-
// @public
|
|
101
|
-
export function restoreTestHarness<T>(wrapper: WithTestHarness<T>): void;
|
|
102
|
-
|
|
103
|
-
// @public (undocumented)
|
|
104
|
-
export type RunCases = (fn: (...args: unknown[]) => unknown, cases: [unknown[], unknown, string?][], assertion?: (...args: unknown[]) => void) => void;
|
|
105
|
-
|
|
106
|
-
// @public
|
|
107
|
-
export function runCases(fn: (...args: unknown[]) => unknown, cases: [unknown[], unknown, string?][], assertion?: (...args: unknown[]) => void): void;
|
|
108
|
-
|
|
109
|
-
export { sinon_2 as sinon }
|
|
110
|
-
|
|
111
|
-
// @public
|
|
112
|
-
export type SinonWrapper<T extends {
|
|
113
|
-
[K in keyof T]: (...args: any) => any;
|
|
114
|
-
}> = {
|
|
115
|
-
[K in keyof T]: sinon_3.SinonSpy<Parameters<T[K]>, ReturnType<T[K]>>;
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
// @public
|
|
119
|
-
export type SpiedFunctions<T> = Omit<FilterConditionally<T, (...args: any[]) => any>, 'constructor'>;
|
|
120
|
-
|
|
121
|
-
export { suite }
|
|
122
|
-
|
|
123
|
-
// @public
|
|
124
|
-
export type SuiteCallback<T> = uvu.Callback<ComponentContext<T>>;
|
|
125
|
-
|
|
126
|
-
export { test_2 as test }
|
|
127
|
-
|
|
128
|
-
// @public
|
|
129
|
-
export function testSpy(constructor: Function): void;
|
|
130
|
-
|
|
131
|
-
// @public
|
|
132
|
-
export const timeout: (callback: (context: any) => Promise<any>, duration?: number) => (context: any) => Promise<any>;
|
|
133
|
-
|
|
134
|
-
export { uvu }
|
|
135
|
-
|
|
136
|
-
// @public
|
|
137
|
-
export type WithTestHarness<T extends {
|
|
138
|
-
[k in keyof T]: any;
|
|
139
|
-
}> = T & SinonWrapper<SpiedFunctions<T>>;
|
|
140
|
-
|
|
141
|
-
// (No @packageDocumentation comment for this package)
|
|
142
|
-
|
|
143
|
-
```
|