@pie-element/shared-test-utils 0.1.1-next.2 → 0.1.1-next.20261002100925

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.
Files changed (2) hide show
  1. package/README.md +12 -9
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -1,11 +1,11 @@
1
- # @pie-element/test-utils
1
+ # @pie-element/shared-test-utils
2
2
 
3
3
  Testing utilities for PIE element development.
4
4
 
5
5
  ## Installation
6
6
 
7
7
  ```bash
8
- bun add -D @pie-element/test-utils
8
+ bun add -D @pie-element/shared-test-utils
9
9
  ```
10
10
 
11
11
  ## Usage
@@ -13,13 +13,13 @@ bun add -D @pie-element/test-utils
13
13
  ### Controller Testing
14
14
 
15
15
  ```typescript
16
- import { testController, testEnvironments } from '@pie-element/test-utils';
16
+ import { testController, testEnvironments } from '@pie-element/shared-test-utils';
17
17
  import { myController } from './controller';
18
18
 
19
19
  const testCases = [
20
20
  {
21
21
  name: 'returns correct view model in gather mode',
22
- question: { id: '1', element: '@pie-element/my-element' },
22
+ question: { id: '1', element: 'my-element' },
23
23
  session: null,
24
24
  env: testEnvironments.studentGather,
25
25
  expectedViewModel: {
@@ -36,7 +36,7 @@ console.log(results); // [{ passed: true, testCase: '...', errors: [] }]
36
36
  ### Fixtures
37
37
 
38
38
  ```typescript
39
- import { createTestModel, createTestSession, testPrompts } from '@pie-element/test-utils';
39
+ import { createTestModel, createTestSession, testPrompts } from '@pie-element/shared-test-utils';
40
40
 
41
41
  const model = createTestModel({ prompt: testPrompts.withMath });
42
42
  const session = createTestSession({ value: ['answer1'] });
@@ -50,7 +50,7 @@ import {
50
50
  waitForEvent,
51
51
  simulateClick,
52
52
  querySelector,
53
- } from '@pie-element/test-utils';
53
+ } from '@pie-element/shared-test-utils';
54
54
 
55
55
  // Mount a component
56
56
  const element = await mountComponent('my-element', {
@@ -58,8 +58,11 @@ const element = await mountComponent('my-element', {
58
58
  session: mySession,
59
59
  });
60
60
 
61
- // Wait for events
62
- const sessionData = await waitForEvent(element, 'pie.session_changed');
61
+ // Wait for events: resolves with the event's detail
62
+ const { complete } = await waitForEvent<{ complete: boolean; component: string }>(
63
+ element,
64
+ 'session-changed'
65
+ );
63
66
 
64
67
  // Simulate interactions
65
68
  const button = querySelector(element, 'button');
@@ -68,7 +71,7 @@ simulateClick(button);
68
71
 
69
72
  ### Author Element Contract
70
73
 
71
- `assertAuthorModelUpdate` mounts an author element, sets `model` and `configuration` as a player does, makes one edit, and throws unless the edit's `model.updated` meets the Authoring Contract in `docs/PIE_ELEMENT_CONTRACT.md`. `assertAuthorElementProperties` checks only that the element declares both properties.
74
+ `assertAuthorModelUpdate` mounts an author element, sets `model` and `configuration` as a player does, makes one edit, and throws unless the edit's `model.updated` meets the [Authoring Contract](https://github.com/pie-framework/pie-elements-ng/blob/develop/docs/PIE_ELEMENT_CONTRACT.md#authoring-contract). `assertAuthorElementProperties` checks only that the element declares both properties.
72
75
 
73
76
  ```typescript
74
77
  import { assertAuthorModelUpdate } from '@pie-element/shared-test-utils';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-element/shared-test-utils",
3
- "version": "0.1.1-next.2",
3
+ "version": "0.1.1-next.20261002100925",
4
4
  "description": "Testing utilities for PIE elements",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -22,8 +22,8 @@
22
22
  "clean": "rm -rf dist"
23
23
  },
24
24
  "dependencies": {
25
- "@pie-element/shared-types": "0.2.0-next.0",
26
- "@pie-element/shared-utils": "0.1.1-next.2"
25
+ "@pie-element/shared-types": "0.2.0-next.20261002100925",
26
+ "@pie-element/shared-utils": "0.1.1-next.20261002100925"
27
27
  },
28
28
  "publishConfig": {
29
29
  "access": "public"