@pie-element/shared-test-utils 0.1.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 +71 -0
- package/dist/controller-test-harness.d.ts +61 -0
- package/dist/controller-test-harness.d.ts.map +1 -0
- package/dist/controller-test-harness.js +95 -0
- package/dist/controller-test-harness.js.map +1 -0
- package/dist/fixtures.d.ts +36 -0
- package/dist/fixtures.d.ts.map +1 -0
- package/dist/fixtures.js +63 -0
- package/dist/fixtures.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/web-component-helpers.d.ts +51 -0
- package/dist/web-component-helpers.d.ts.map +1 -0
- package/dist/web-component-helpers.js +100 -0
- package/dist/web-component-helpers.js.map +1 -0
- package/package.json +36 -0
package/README.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# @pie-element/test-utils
|
|
2
|
+
|
|
3
|
+
Testing utilities for PIE element development.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
bun add -D @pie-element/test-utils
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### Controller Testing
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { testController, testEnvironments } from '@pie-element/test-utils';
|
|
17
|
+
import { myController } from './controller';
|
|
18
|
+
|
|
19
|
+
const testCases = [
|
|
20
|
+
{
|
|
21
|
+
name: 'returns correct view model in gather mode',
|
|
22
|
+
question: { id: '1', element: '@pie-element/my-element' },
|
|
23
|
+
session: null,
|
|
24
|
+
env: testEnvironments.studentGather,
|
|
25
|
+
expectedViewModel: {
|
|
26
|
+
disabled: false,
|
|
27
|
+
mode: 'gather',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
const results = await testController(myController, testCases);
|
|
33
|
+
console.log(results); // [{ passed: true, testCase: '...', errors: [] }]
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Fixtures
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
import { createTestModel, createTestSession, testPrompts } from '@pie-element/test-utils';
|
|
40
|
+
|
|
41
|
+
const model = createTestModel({ prompt: testPrompts.withMath });
|
|
42
|
+
const session = createTestSession({ value: ['answer1'] });
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Web Component Testing
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
import {
|
|
49
|
+
mountComponent,
|
|
50
|
+
waitForEvent,
|
|
51
|
+
simulateClick,
|
|
52
|
+
querySelector,
|
|
53
|
+
} from '@pie-element/test-utils';
|
|
54
|
+
|
|
55
|
+
// Mount a component
|
|
56
|
+
const element = await mountComponent('my-element', {
|
|
57
|
+
model: myModel,
|
|
58
|
+
session: mySession,
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
// Wait for events
|
|
62
|
+
const sessionData = await waitForEvent(element, 'pie.session_changed');
|
|
63
|
+
|
|
64
|
+
// Simulate interactions
|
|
65
|
+
const button = querySelector(element, 'button');
|
|
66
|
+
simulateClick(button);
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## API Reference
|
|
70
|
+
|
|
71
|
+
See [TypeScript definitions](./src/index.ts) for complete API documentation.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Controller Test Harness
|
|
3
|
+
*
|
|
4
|
+
* Provides utilities for testing PIE element controllers.
|
|
5
|
+
*/
|
|
6
|
+
import type { OutcomeResult, PieController, PieEnvironment, PieModel, PieSession } from '@pie-element/shared-types';
|
|
7
|
+
export interface ControllerTestCase {
|
|
8
|
+
name: string;
|
|
9
|
+
question: PieModel;
|
|
10
|
+
session: PieSession | null;
|
|
11
|
+
env: PieEnvironment;
|
|
12
|
+
expectedViewModel?: Record<string, unknown>;
|
|
13
|
+
expectedOutcome?: OutcomeResult;
|
|
14
|
+
}
|
|
15
|
+
export interface TestResult {
|
|
16
|
+
passed: boolean;
|
|
17
|
+
testCase: string;
|
|
18
|
+
errors: string[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Test a controller with multiple test cases
|
|
22
|
+
*/
|
|
23
|
+
export declare function testController(controller: PieController, testCases: ControllerTestCase[]): Promise<TestResult[]>;
|
|
24
|
+
/**
|
|
25
|
+
* Assert that a controller test passes
|
|
26
|
+
*/
|
|
27
|
+
export declare function assertControllerTest(controller: PieController, testCase: ControllerTestCase): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Create common test environments
|
|
30
|
+
*/
|
|
31
|
+
export declare const testEnvironments: {
|
|
32
|
+
studentGather: {
|
|
33
|
+
mode: "gather";
|
|
34
|
+
role: "student";
|
|
35
|
+
};
|
|
36
|
+
studentView: {
|
|
37
|
+
mode: "view";
|
|
38
|
+
role: "student";
|
|
39
|
+
};
|
|
40
|
+
studentEvaluate: {
|
|
41
|
+
mode: "evaluate";
|
|
42
|
+
role: "student";
|
|
43
|
+
};
|
|
44
|
+
instructorGather: {
|
|
45
|
+
mode: "gather";
|
|
46
|
+
role: "instructor";
|
|
47
|
+
};
|
|
48
|
+
instructorView: {
|
|
49
|
+
mode: "view";
|
|
50
|
+
role: "instructor";
|
|
51
|
+
};
|
|
52
|
+
instructorEvaluate: {
|
|
53
|
+
mode: "evaluate";
|
|
54
|
+
role: "instructor";
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Create a mock controller for testing
|
|
59
|
+
*/
|
|
60
|
+
export declare function createMockController(overrides?: Partial<PieController>): PieController;
|
|
61
|
+
//# sourceMappingURL=controller-test-harness.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controller-test-harness.d.ts","sourceRoot":"","sources":["../src/controller-test-harness.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,cAAc,EACd,QAAQ,EACR,UAAU,EACX,MAAM,2BAA2B,CAAC;AAEnC,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,QAAQ,CAAC;IACnB,OAAO,EAAE,UAAU,GAAG,IAAI,CAAC;IAC3B,GAAG,EAAE,cAAc,CAAC;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC5C,eAAe,CAAC,EAAE,aAAa,CAAC;CACjC;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED;;GAEG;AACH,wBAAsB,cAAc,CAClC,UAAU,EAAE,aAAa,EACzB,SAAS,EAAE,kBAAkB,EAAE,GAC9B,OAAO,CAAC,UAAU,EAAE,CAAC,CA4CvB;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CACxC,UAAU,EAAE,aAAa,EACzB,QAAQ,EAAE,kBAAkB,GAC3B,OAAO,CAAC,IAAI,CAAC,CASf;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;CAO5B,CAAC;AAEF;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,aAAa,CA2BtF"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Controller Test Harness
|
|
3
|
+
*
|
|
4
|
+
* Provides utilities for testing PIE element controllers.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Test a controller with multiple test cases
|
|
8
|
+
*/
|
|
9
|
+
export async function testController(controller, testCases) {
|
|
10
|
+
const results = [];
|
|
11
|
+
for (const tc of testCases) {
|
|
12
|
+
const errors = [];
|
|
13
|
+
try {
|
|
14
|
+
// Test model() function
|
|
15
|
+
const viewModel = await controller.model(tc.question, tc.session, tc.env);
|
|
16
|
+
if (tc.expectedViewModel) {
|
|
17
|
+
for (const [key, expectedValue] of Object.entries(tc.expectedViewModel)) {
|
|
18
|
+
if (JSON.stringify(viewModel[key]) !== JSON.stringify(expectedValue)) {
|
|
19
|
+
errors.push(`Expected ${key} to be ${JSON.stringify(expectedValue)}, got ${JSON.stringify(viewModel[key])}`);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
// Test outcome() function if session and expected outcome provided
|
|
24
|
+
if (tc.expectedOutcome && tc.session) {
|
|
25
|
+
const outcome = await controller.outcome(tc.question, tc.session, tc.env);
|
|
26
|
+
if (outcome.score !== tc.expectedOutcome.score ||
|
|
27
|
+
outcome.empty !== tc.expectedOutcome.empty) {
|
|
28
|
+
errors.push(`Expected outcome ${JSON.stringify(tc.expectedOutcome)}, got ${JSON.stringify(outcome)}`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
errors.push(`Exception: ${error instanceof Error ? error.message : String(error)}`);
|
|
34
|
+
}
|
|
35
|
+
results.push({
|
|
36
|
+
passed: errors.length === 0,
|
|
37
|
+
testCase: tc.name,
|
|
38
|
+
errors,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return results;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Assert that a controller test passes
|
|
45
|
+
*/
|
|
46
|
+
export async function assertControllerTest(controller, testCase) {
|
|
47
|
+
const results = await testController(controller, [testCase]);
|
|
48
|
+
const result = results[0];
|
|
49
|
+
if (!result.passed) {
|
|
50
|
+
throw new Error(`Test "${result.testCase}" failed:\n${result.errors.map((e) => ` - ${e}`).join('\n')}`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Create common test environments
|
|
55
|
+
*/
|
|
56
|
+
export const testEnvironments = {
|
|
57
|
+
studentGather: { mode: 'gather', role: 'student' },
|
|
58
|
+
studentView: { mode: 'view', role: 'student' },
|
|
59
|
+
studentEvaluate: { mode: 'evaluate', role: 'student' },
|
|
60
|
+
instructorGather: { mode: 'gather', role: 'instructor' },
|
|
61
|
+
instructorView: { mode: 'view', role: 'instructor' },
|
|
62
|
+
instructorEvaluate: { mode: 'evaluate', role: 'instructor' },
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Create a mock controller for testing
|
|
66
|
+
*/
|
|
67
|
+
export function createMockController(overrides) {
|
|
68
|
+
return {
|
|
69
|
+
async model(question, _session, env) {
|
|
70
|
+
return {
|
|
71
|
+
disabled: env.mode !== 'gather',
|
|
72
|
+
mode: env.mode,
|
|
73
|
+
...question,
|
|
74
|
+
};
|
|
75
|
+
},
|
|
76
|
+
async outcome(_model, _session, _env) {
|
|
77
|
+
return { score: 1, empty: false };
|
|
78
|
+
},
|
|
79
|
+
createDefaultModel(partial = {}) {
|
|
80
|
+
return {
|
|
81
|
+
id: 'test',
|
|
82
|
+
element: '@pie-element/test',
|
|
83
|
+
...partial,
|
|
84
|
+
};
|
|
85
|
+
},
|
|
86
|
+
validate(_model, _config) {
|
|
87
|
+
return {};
|
|
88
|
+
},
|
|
89
|
+
createCorrectResponseSession(_question, _env) {
|
|
90
|
+
return { id: 'test' };
|
|
91
|
+
},
|
|
92
|
+
...overrides,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=controller-test-harness.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controller-test-harness.js","sourceRoot":"","sources":["../src/controller-test-harness.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAyBH;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,UAAyB,EACzB,SAA+B;IAE/B,MAAM,OAAO,GAAiB,EAAE,CAAC;IAEjC,KAAK,MAAM,EAAE,IAAI,SAAS,EAAE,CAAC;QAC3B,MA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,EAAE,MAAe,EAAE,IAAI,EAAE,YAAqB,EAAE;IACtE,kBAAkB,EAAE,EAAE,IAAI,EAAE,UAAmB,EAAE,IAAI,EAAE,YAAqB,EAAE;CAC/E,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,SAAkC;IACrE,OAAO;QACL,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,QAAQ,EAAE,GAAG;YACjC,OAAO;gBACL,QAAQ,EAAE,GAAG,CAAC,IAAI,KAAK,QAAQ;gBAC/B,IAAI,EAAE,GAAG,CAAC,IAAI;gBACd,GAAG,QAAQ;aACZ,CAAC;QACJ,CAAC;QACD,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI;YAClC,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;QACpC,CAAC;QACD,kBAAkB,CAAC,OAAO,GAAG,EAAE;YAC7B,OAAO;gBACL,EAAE,EAAE,MAAM;gBACV,OAAO,EAAE,mBAAmB;gBAC5B,GAAG,OAAO;aACX,CAAC;QACJ,CAAC;QACD,QAAQ,CAAC,MAAM,EAAE,OAAO;YACtB,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,4BAA4B,CAAC,SAAS,EAAE,IAAI;YAC1C,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC;QACxB,CAAC;QACD,GAAG,SAAS;KACb,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test Fixtures
|
|
3
|
+
*
|
|
4
|
+
* Common test data and fixture generators.
|
|
5
|
+
*/
|
|
6
|
+
import type { PieModel, PieSession } from '@pie-element/shared-types';
|
|
7
|
+
/**
|
|
8
|
+
* Create a basic PIE model for testing
|
|
9
|
+
*/
|
|
10
|
+
export declare function createTestModel(overrides?: Partial<PieModel>): PieModel;
|
|
11
|
+
/**
|
|
12
|
+
* Create a basic PIE session for testing
|
|
13
|
+
*/
|
|
14
|
+
export declare function createTestSession(overrides?: Partial<PieSession>): PieSession;
|
|
15
|
+
/**
|
|
16
|
+
* Create multiple test models
|
|
17
|
+
*/
|
|
18
|
+
export declare function createTestModels(count: number, overrides?: Partial<PieModel>): PieModel[];
|
|
19
|
+
/**
|
|
20
|
+
* Common test prompts
|
|
21
|
+
*/
|
|
22
|
+
export declare const testPrompts: {
|
|
23
|
+
simple: string;
|
|
24
|
+
withHtml: string;
|
|
25
|
+
withMath: string;
|
|
26
|
+
multiline: string;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Wait for a promise with timeout
|
|
30
|
+
*/
|
|
31
|
+
export declare function withTimeout<T>(promise: Promise<T>, ms: number): Promise<T>;
|
|
32
|
+
/**
|
|
33
|
+
* Sleep for testing
|
|
34
|
+
*/
|
|
35
|
+
export declare function sleep(ms: number): Promise<void>;
|
|
36
|
+
//# sourceMappingURL=fixtures.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../src/fixtures.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAGtE;;GAEG;AACH,wBAAgB,eAAe,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAMvE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,UAAU,CAK7E;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ,EAAE,CAOzF;AAED;;GAEG;AACH,eAAO,MAAM,WAAW;;;;;CASvB,CAAC;AAEF;;GAEG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAK1E;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE/C"}
|
package/dist/fixtures.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test Fixtures
|
|
3
|
+
*
|
|
4
|
+
* Common test data and fixture generators.
|
|
5
|
+
*/
|
|
6
|
+
import { uuid } from '@pie-element/shared-utils';
|
|
7
|
+
/**
|
|
8
|
+
* Create a basic PIE model for testing
|
|
9
|
+
*/
|
|
10
|
+
export function createTestModel(overrides) {
|
|
11
|
+
return {
|
|
12
|
+
id: uuid(),
|
|
13
|
+
element: '@pie-element/test',
|
|
14
|
+
...overrides,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Create a basic PIE session for testing
|
|
19
|
+
*/
|
|
20
|
+
export function createTestSession(overrides) {
|
|
21
|
+
return {
|
|
22
|
+
id: uuid(),
|
|
23
|
+
...overrides,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Create multiple test models
|
|
28
|
+
*/
|
|
29
|
+
export function createTestModels(count, overrides) {
|
|
30
|
+
return Array.from({ length: count }, (_, i) => createTestModel({
|
|
31
|
+
id: `test-${i}`,
|
|
32
|
+
...overrides,
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Common test prompts
|
|
37
|
+
*/
|
|
38
|
+
export const testPrompts = {
|
|
39
|
+
simple: 'What is the answer?',
|
|
40
|
+
withHtml: '<p>What is the <strong>correct</strong> answer?</p>',
|
|
41
|
+
withMath: 'Solve for x: $x^2 + 2x + 1 = 0$',
|
|
42
|
+
multiline: `
|
|
43
|
+
<p>Read the following passage:</p>
|
|
44
|
+
<blockquote>This is a test passage.</blockquote>
|
|
45
|
+
<p>Answer the question below:</p>
|
|
46
|
+
`,
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Wait for a promise with timeout
|
|
50
|
+
*/
|
|
51
|
+
export function withTimeout(promise, ms) {
|
|
52
|
+
return Promise.race([
|
|
53
|
+
promise,
|
|
54
|
+
new Promise((_, reject) => setTimeout(() => reject(new Error(`Timeout after ${ms}ms`)), ms)),
|
|
55
|
+
]);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Sleep for testing
|
|
59
|
+
*/
|
|
60
|
+
export function sleep(ms) {
|
|
61
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=fixtures.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fixtures.js","sourceRoot":"","sources":["../src/fixtures.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AAEjD;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,SAA6B;IAC3D,OAAO;QACL,EAAE,EAAE,IAAI,EAAE;QACV,OAAO,EAAE,mBAAmB;QAC5B,GAAG,SAAS;KACb,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,SAA+B;IAC/D,OAAO;QACL,EAAE,EAAE,IAAI,EAAE;QACV,GAAG,SAAS;KACb,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAa,EAAE,SAA6B;IAC3E,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAC5C,eAAe,CAAC;QACd,EAAE,EAAE,QAAQ,CAAC,EAAE;QACf,GAAG,SAAS;KACb,CAAC,CACH,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,MAAM,EAAE,qBAAqB;IAC7B,QAAQ,EAAE,qDAAqD;IAC/D,QAAQ,EAAE,iCAAiC;IAC3C,SAAS,EAAE;;;;GAIV;CACF,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,WAAW,CAAI,OAAmB,EAAE,EAAU;IAC5D,OAAO,OAAO,CAAC,IAAI,CAAC;QAClB,OAAO;QACP,IAAI,OAAO,CAAI,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;KAChG,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,KAAK,CAAC,EAAU;IAC9B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC3D,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,2BAA2B,CAAC;AAC1C,cAAc,YAAY,CAAC;AAC3B,cAAc,yBAAyB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,2BAA2B,CAAC;AAC1C,cAAc,YAAY,CAAC;AAC3B,cAAc,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Web Component Test Helpers
|
|
3
|
+
*
|
|
4
|
+
* Utilities for testing PIE Web Components.
|
|
5
|
+
*/
|
|
6
|
+
import type { PieModel, PieSession } from '@pie-element/shared-types';
|
|
7
|
+
/**
|
|
8
|
+
* Create a test container for web components
|
|
9
|
+
*/
|
|
10
|
+
export declare function createTestContainer(): HTMLElement;
|
|
11
|
+
/**
|
|
12
|
+
* Clean up a test container
|
|
13
|
+
*/
|
|
14
|
+
export declare function cleanupTestContainer(container: HTMLElement): void;
|
|
15
|
+
/**
|
|
16
|
+
* Wait for a web component to be defined
|
|
17
|
+
*/
|
|
18
|
+
export declare function waitForComponentDefined(tagName: string, timeout?: number): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Create and mount a web component
|
|
21
|
+
*/
|
|
22
|
+
export declare function mountComponent<T extends HTMLElement>(tagName: string, props?: {
|
|
23
|
+
model?: PieModel;
|
|
24
|
+
session?: PieSession;
|
|
25
|
+
[key: string]: unknown;
|
|
26
|
+
}): Promise<T>;
|
|
27
|
+
/**
|
|
28
|
+
* Wait for an event to be dispatched
|
|
29
|
+
*/
|
|
30
|
+
export declare function waitForEvent<T = unknown>(element: HTMLElement, eventName: string, timeout?: number): Promise<T>;
|
|
31
|
+
/**
|
|
32
|
+
* Simulate user input on an element
|
|
33
|
+
*/
|
|
34
|
+
export declare function simulateInput(element: HTMLInputElement | HTMLTextAreaElement, value: string): void;
|
|
35
|
+
/**
|
|
36
|
+
* Simulate a click on an element
|
|
37
|
+
*/
|
|
38
|
+
export declare function simulateClick(element: HTMLElement): void;
|
|
39
|
+
/**
|
|
40
|
+
* Simulate keyboard event
|
|
41
|
+
*/
|
|
42
|
+
export declare function simulateKeyboard(element: HTMLElement, key: string, eventType?: 'keydown' | 'keyup' | 'keypress'): void;
|
|
43
|
+
/**
|
|
44
|
+
* Query selector with type safety
|
|
45
|
+
*/
|
|
46
|
+
export declare function querySelector<T extends HTMLElement>(container: HTMLElement | Document, selector: string): T | null;
|
|
47
|
+
/**
|
|
48
|
+
* Query selector all with type safety
|
|
49
|
+
*/
|
|
50
|
+
export declare function querySelectorAll<T extends HTMLElement>(container: HTMLElement | Document, selector: string): T[];
|
|
51
|
+
//# sourceMappingURL=web-component-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-component-helpers.d.ts","sourceRoot":"","sources":["../src/web-component-helpers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAGtE;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,WAAW,CAKjD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,WAAW,GAAG,IAAI,CAEjE;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,SAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAQ5F;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,CAAC,SAAS,WAAW,EACxD,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE;IACN,KAAK,CAAC,EAAE,QAAQ,CAAC;IACjB,OAAO,CAAC,EAAE,UAAU,CAAC;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,GACA,OAAO,CAAC,CAAC,CAAC,CAYZ;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,CAAC,GAAG,OAAO,EACtC,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,MAAM,EACjB,OAAO,SAAO,GACb,OAAO,CAAC,CAAC,CAAC,CAeZ;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,gBAAgB,GAAG,mBAAmB,EAC/C,KAAK,EAAE,MAAM,GACZ,IAAI,CAIN;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAExD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,WAAW,EACpB,GAAG,EAAE,MAAM,EACX,SAAS,GAAE,SAAS,GAAG,OAAO,GAAG,UAAsB,GACtD,IAAI,CAQN;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,WAAW,EACjD,SAAS,EAAE,WAAW,GAAG,QAAQ,EACjC,QAAQ,EAAE,MAAM,GACf,CAAC,GAAG,IAAI,CAEV;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,WAAW,EACpD,SAAS,EAAE,WAAW,GAAG,QAAQ,EACjC,QAAQ,EAAE,MAAM,GACf,CAAC,EAAE,CAEL"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Web Component Test Helpers
|
|
3
|
+
*
|
|
4
|
+
* Utilities for testing PIE Web Components.
|
|
5
|
+
*/
|
|
6
|
+
import { assignProps } from '@pie-element/shared-utils';
|
|
7
|
+
/**
|
|
8
|
+
* Create a test container for web components
|
|
9
|
+
*/
|
|
10
|
+
export function createTestContainer() {
|
|
11
|
+
const container = document.createElement('div');
|
|
12
|
+
container.id = `test-container-${Date.now()}`;
|
|
13
|
+
document.body.appendChild(container);
|
|
14
|
+
return container;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Clean up a test container
|
|
18
|
+
*/
|
|
19
|
+
export function cleanupTestContainer(container) {
|
|
20
|
+
container.remove();
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Wait for a web component to be defined
|
|
24
|
+
*/
|
|
25
|
+
export async function waitForComponentDefined(tagName, timeout = 5000) {
|
|
26
|
+
const startTime = Date.now();
|
|
27
|
+
while (!customElements.get(tagName)) {
|
|
28
|
+
if (Date.now() - startTime > timeout) {
|
|
29
|
+
throw new Error(`Component ${tagName} was not defined within ${timeout}ms`);
|
|
30
|
+
}
|
|
31
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Create and mount a web component
|
|
36
|
+
*/
|
|
37
|
+
export async function mountComponent(tagName, props) {
|
|
38
|
+
await waitForComponentDefined(tagName);
|
|
39
|
+
const container = createTestContainer();
|
|
40
|
+
const element = document.createElement(tagName);
|
|
41
|
+
if (props) {
|
|
42
|
+
assignProps(element, props);
|
|
43
|
+
}
|
|
44
|
+
container.appendChild(element);
|
|
45
|
+
return element;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Wait for an event to be dispatched
|
|
49
|
+
*/
|
|
50
|
+
export function waitForEvent(element, eventName, timeout = 5000) {
|
|
51
|
+
return new Promise((resolve, reject) => {
|
|
52
|
+
const timeoutId = setTimeout(() => {
|
|
53
|
+
element.removeEventListener(eventName, handler);
|
|
54
|
+
reject(new Error(`Event ${eventName} was not dispatched within ${timeout}ms`));
|
|
55
|
+
}, timeout);
|
|
56
|
+
const handler = (event) => {
|
|
57
|
+
clearTimeout(timeoutId);
|
|
58
|
+
element.removeEventListener(eventName, handler);
|
|
59
|
+
resolve(event.detail);
|
|
60
|
+
};
|
|
61
|
+
element.addEventListener(eventName, handler);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Simulate user input on an element
|
|
66
|
+
*/
|
|
67
|
+
export function simulateInput(element, value) {
|
|
68
|
+
element.value = value;
|
|
69
|
+
element.dispatchEvent(new Event('input', { bubbles: true }));
|
|
70
|
+
element.dispatchEvent(new Event('change', { bubbles: true }));
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Simulate a click on an element
|
|
74
|
+
*/
|
|
75
|
+
export function simulateClick(element) {
|
|
76
|
+
element.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true }));
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Simulate keyboard event
|
|
80
|
+
*/
|
|
81
|
+
export function simulateKeyboard(element, key, eventType = 'keydown') {
|
|
82
|
+
element.dispatchEvent(new KeyboardEvent(eventType, {
|
|
83
|
+
key,
|
|
84
|
+
bubbles: true,
|
|
85
|
+
cancelable: true,
|
|
86
|
+
}));
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Query selector with type safety
|
|
90
|
+
*/
|
|
91
|
+
export function querySelector(container, selector) {
|
|
92
|
+
return container.querySelector(selector);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Query selector all with type safety
|
|
96
|
+
*/
|
|
97
|
+
export function querySelectorAll(container, selector) {
|
|
98
|
+
return Array.from(container.querySelectorAll(selector));
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=web-component-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-component-helpers.js","sourceRoot":"","sources":["../src/web-component-helpers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD;;GAEG;AACH,MAAM,UAAU,mBAAmB;IACjC,MAAM,SAAS,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAChD,SAAS,CAAC,EAAE,GAAG,kBAAkB,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;IAC9C,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;IACrC,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,SAAsB;IACzD,SAAS,CAAC,MAAM,EAAE,CAAC;AACrB,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,OAAe,EAAE,OAAO,GAAG,IAAI;IAC3E,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAC7B,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;QACpC,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,GAAG,OAAO,EAAE,CAAC;YACrC,MAAM,IAAI,KAAK,CAAC,aAAa,OAAO,2BAA2B,OAAO,IAAI,CAAC,CAAC;QAC9E,CAAC;QACD,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO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C3B,OAA+C,EAC/C,KAAa;IAEb,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;IACtB,OAAO,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAC7D,OAAO,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AAChE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,OAAoB;IAChD,OAAO,CAAC,aAAa,CAAC,IAAI,UAAU,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACtF,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC9B,OAAoB,EACpB,GAAW,EACX,YAA8C,SAAS;IAEvD,OAAO,CAAC,aAAa,CACnB,IAAI,aAAa,CAAC,SAAS,EAAE;QAC3B,GAAG;QACH,OAAO,EAAE,IAAI;QACb,UAAU,EAAE,IAAI;KACjB,CAAC,CACH,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAC3B,SAAiC,EACjC,QAAgB;IAEhB,OAAO,SAAS,CAAC,aAAa,CAAI,QAAQ,CAAC,CAAC;AAC9C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC9B,SAAiC,EACjC,QAAgB;IAEhB,OAAO,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAI,QAAQ,CAAC,CAAC,CAAC;AAC7D,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pie-element/shared-test-utils",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Testing utilities for PIE elements",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"default": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsc",
|
|
19
|
+
"dev": "tsc --watch",
|
|
20
|
+
"test": "vitest run",
|
|
21
|
+
"test:watch": "vitest",
|
|
22
|
+
"clean": "rm -rf dist"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@pie-element/shared-types": "workspace:*",
|
|
26
|
+
"@pie-element/shared-utils": "workspace:*"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@types/bun": "latest",
|
|
30
|
+
"typescript": "^5.9.3"
|
|
31
|
+
},
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public"
|
|
34
|
+
},
|
|
35
|
+
"license": "MIT"
|
|
36
|
+
}
|