@metamesh/testkit 0.0.0-bootstrap.0 → 0.13.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/CHANGELOG.md +225 -0
- package/README.md +112 -5
- package/dist/assertions.d.ts +20 -0
- package/dist/assertions.d.ts.map +1 -0
- package/dist/assertions.js +103 -0
- package/dist/assertions.js.map +1 -0
- package/dist/docs/guides/package.md +113 -0
- package/dist/docs/manifest.json +259 -0
- package/dist/docs/reference/font-fixtures/LoadedFontFixtures.md +12 -0
- package/dist/docs/reference/font-fixtures/loadFontFixtureServices.md +10 -0
- package/dist/docs/reference/font-fixtures/loadFontFixtures.md +10 -0
- package/dist/docs/reference/fonts/FontTestFixture.md +17 -0
- package/dist/docs/reference/fonts/prepareFontTestServices.md +10 -0
- package/dist/docs/reference/index/GeneratorTestExecution.md +18 -0
- package/dist/docs/reference/index/GeneratorTestRunner.md +18 -0
- package/dist/docs/reference/index/GeneratorTestRunnerOptions.md +14 -0
- package/dist/docs/reference/index/MeshMeasurementExpectation.md +19 -0
- package/dist/docs/reference/index/MeshMeasurementTolerances.md +17 -0
- package/dist/docs/reference/index/createGeneratorTestRunner.md +12 -0
- package/dist/docs/reference/index/expectMeshMeasurements.md +14 -0
- package/dist/docs/reference/index/expectSerializableDefinition.md +10 -0
- package/dist/docs/reference/index/expectValidDefaults.md +10 -0
- package/dist/docs/reference/index/expectValidParts.md +19 -0
- package/dist/docs/reference/index/expectValidPresets.md +10 -0
- package/dist/docs/reference/index/getTestEngine.md +13 -0
- package/dist/engine.d.ts +7 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +11 -0
- package/dist/engine.js.map +1 -0
- package/dist/font-fixtures.d.ts +10 -0
- package/dist/font-fixtures.d.ts.map +1 -0
- package/dist/font-fixtures.js +75 -0
- package/dist/font-fixtures.js.map +1 -0
- package/dist/fonts.d.ts +13 -0
- package/dist/fonts.d.ts.map +1 -0
- package/dist/fonts.js +34 -0
- package/dist/fonts.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/measurements.d.ts +28 -0
- package/dist/measurements.d.ts.map +1 -0
- package/dist/measurements.js +66 -0
- package/dist/measurements.js.map +1 -0
- package/dist/runner.d.ts +34 -0
- package/dist/runner.d.ts.map +1 -0
- package/dist/runner.js +118 -0
- package/dist/runner.js.map +1 -0
- package/package.json +43 -6
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
{
|
|
2
|
+
"formatVersion": 1,
|
|
3
|
+
"packageName": "@metamesh/testkit",
|
|
4
|
+
"packageVersion": "0.13.0",
|
|
5
|
+
"documents": [
|
|
6
|
+
{
|
|
7
|
+
"id": "testkit/guide/testing",
|
|
8
|
+
"title": "Test models and Generators",
|
|
9
|
+
"summary": "Runner-neutral MetaMesh model and Generator testing helpers, assertions, and local font fixtures.",
|
|
10
|
+
"path": "guides/package.md",
|
|
11
|
+
"importPath": "@metamesh/testkit",
|
|
12
|
+
"availability": "Local Node testing",
|
|
13
|
+
"canonical": "https://metamesh.studio/docs/develop/agent-authoring#test-models",
|
|
14
|
+
"keywords": [
|
|
15
|
+
"guide",
|
|
16
|
+
"installation",
|
|
17
|
+
"testkit"
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"id": "testkit/reference/font-fixtures/LoadedFontFixtures",
|
|
22
|
+
"title": "LoadedFontFixtures",
|
|
23
|
+
"summary": "LoadedFontFixtures exported from @metamesh/testkit/font-fixtures.",
|
|
24
|
+
"path": "reference/font-fixtures/LoadedFontFixtures.md",
|
|
25
|
+
"importPath": "@metamesh/testkit/font-fixtures",
|
|
26
|
+
"availability": "Local Node testing",
|
|
27
|
+
"canonical": "https://metamesh.studio/docs/develop/agent-authoring#test-models",
|
|
28
|
+
"keywords": [
|
|
29
|
+
"reference",
|
|
30
|
+
"font-fixtures",
|
|
31
|
+
"LoadedFontFixtures"
|
|
32
|
+
]
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"id": "testkit/reference/font-fixtures/loadFontFixtures",
|
|
36
|
+
"title": "loadFontFixtures",
|
|
37
|
+
"summary": "Node-only local descriptor loader. Paths resolve beside the descriptor; bytes never come from a catalog.",
|
|
38
|
+
"path": "reference/font-fixtures/loadFontFixtures.md",
|
|
39
|
+
"importPath": "@metamesh/testkit/font-fixtures",
|
|
40
|
+
"availability": "Local Node testing",
|
|
41
|
+
"canonical": "https://metamesh.studio/docs/develop/agent-authoring#test-models",
|
|
42
|
+
"keywords": [
|
|
43
|
+
"reference",
|
|
44
|
+
"font-fixtures",
|
|
45
|
+
"loadFontFixtures"
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"id": "testkit/reference/font-fixtures/loadFontFixtureServices",
|
|
50
|
+
"title": "loadFontFixtureServices",
|
|
51
|
+
"summary": "Fixture provider matching createGeneratorTestRunner's asynchronous service boundary.",
|
|
52
|
+
"path": "reference/font-fixtures/loadFontFixtureServices.md",
|
|
53
|
+
"importPath": "@metamesh/testkit/font-fixtures",
|
|
54
|
+
"availability": "Local Node testing",
|
|
55
|
+
"canonical": "https://metamesh.studio/docs/develop/agent-authoring#test-models",
|
|
56
|
+
"keywords": [
|
|
57
|
+
"reference",
|
|
58
|
+
"font-fixtures",
|
|
59
|
+
"loadFontFixtureServices"
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"id": "testkit/reference/fonts/FontTestFixture",
|
|
64
|
+
"title": "FontTestFixture",
|
|
65
|
+
"summary": "A checked-in immutable font fixture; no catalog or network is used by the test harness.",
|
|
66
|
+
"path": "reference/fonts/FontTestFixture.md",
|
|
67
|
+
"importPath": "@metamesh/testkit/fonts",
|
|
68
|
+
"availability": "Local Node testing",
|
|
69
|
+
"canonical": "https://metamesh.studio/docs/develop/agent-authoring#test-models",
|
|
70
|
+
"keywords": [
|
|
71
|
+
"reference",
|
|
72
|
+
"fonts",
|
|
73
|
+
"FontTestFixture"
|
|
74
|
+
]
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"id": "testkit/reference/fonts/prepareFontTestServices",
|
|
78
|
+
"title": "prepareFontTestServices",
|
|
79
|
+
"summary": "Prepares the same synchronous text service used by Studio, from reproducible fixture bytes.",
|
|
80
|
+
"path": "reference/fonts/prepareFontTestServices.md",
|
|
81
|
+
"importPath": "@metamesh/testkit/fonts",
|
|
82
|
+
"availability": "Local Node testing",
|
|
83
|
+
"canonical": "https://metamesh.studio/docs/develop/agent-authoring#test-models",
|
|
84
|
+
"keywords": [
|
|
85
|
+
"reference",
|
|
86
|
+
"fonts",
|
|
87
|
+
"prepareFontTestServices"
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"id": "testkit/reference/index/createGeneratorTestRunner",
|
|
92
|
+
"title": "createGeneratorTestRunner",
|
|
93
|
+
"summary": "Creates a lazy runner for one generation program without loading assets or an engine.",
|
|
94
|
+
"path": "reference/index/createGeneratorTestRunner.md",
|
|
95
|
+
"importPath": "@metamesh/testkit",
|
|
96
|
+
"availability": "Local Node testing",
|
|
97
|
+
"canonical": "https://metamesh.studio/docs/develop/agent-authoring#test-models",
|
|
98
|
+
"keywords": [
|
|
99
|
+
"reference",
|
|
100
|
+
"index",
|
|
101
|
+
"createGeneratorTestRunner"
|
|
102
|
+
]
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"id": "testkit/reference/index/expectMeshMeasurements",
|
|
106
|
+
"title": "expectMeshMeasurements",
|
|
107
|
+
"summary": "Analyzes current buffers, requires closed oriented edge topology, and checks selected physical facts with explicit absolute tolerances. Returns fresh measurements without initializing an engine. These facts do not prove geometric equivalence or absence of self-intersections.",
|
|
108
|
+
"path": "reference/index/expectMeshMeasurements.md",
|
|
109
|
+
"importPath": "@metamesh/testkit",
|
|
110
|
+
"availability": "Local Node testing",
|
|
111
|
+
"canonical": "https://metamesh.studio/docs/develop/agent-authoring#test-models",
|
|
112
|
+
"keywords": [
|
|
113
|
+
"reference",
|
|
114
|
+
"index",
|
|
115
|
+
"expectMeshMeasurements"
|
|
116
|
+
]
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"id": "testkit/reference/index/expectSerializableDefinition",
|
|
120
|
+
"title": "expectSerializableDefinition",
|
|
121
|
+
"summary": "Throws unless a definition already has the canonical package-serializable representation.",
|
|
122
|
+
"path": "reference/index/expectSerializableDefinition.md",
|
|
123
|
+
"importPath": "@metamesh/testkit",
|
|
124
|
+
"availability": "Local Node testing",
|
|
125
|
+
"canonical": "https://metamesh.studio/docs/develop/agent-authoring#test-models",
|
|
126
|
+
"keywords": [
|
|
127
|
+
"reference",
|
|
128
|
+
"index",
|
|
129
|
+
"expectSerializableDefinition"
|
|
130
|
+
]
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"id": "testkit/reference/index/expectValidDefaults",
|
|
134
|
+
"title": "expectValidDefaults",
|
|
135
|
+
"summary": "Throws unless defaults strictly decode and equal the defaults derived from the definition.",
|
|
136
|
+
"path": "reference/index/expectValidDefaults.md",
|
|
137
|
+
"importPath": "@metamesh/testkit",
|
|
138
|
+
"availability": "Local Node testing",
|
|
139
|
+
"canonical": "https://metamesh.studio/docs/develop/agent-authoring#test-models",
|
|
140
|
+
"keywords": [
|
|
141
|
+
"reference",
|
|
142
|
+
"index",
|
|
143
|
+
"expectValidDefaults"
|
|
144
|
+
]
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"id": "testkit/reference/index/expectValidParts",
|
|
148
|
+
"title": "expectValidParts",
|
|
149
|
+
"summary": "Checks finalized engine parts after omitting measurement facts from their strict wire DTOs. Runs mesh reconstruction/finalization synchronously using the supplied engine. Strictly checks unknown wire data and reconstructs its meshes using the supplied engine. Initializes the shared test engine lazily, then applies the same wire and mesh checks.",
|
|
150
|
+
"path": "reference/index/expectValidParts.md",
|
|
151
|
+
"importPath": "@metamesh/testkit",
|
|
152
|
+
"availability": "Local Node testing",
|
|
153
|
+
"canonical": "https://metamesh.studio/docs/develop/agent-authoring#test-models",
|
|
154
|
+
"keywords": [
|
|
155
|
+
"reference",
|
|
156
|
+
"index",
|
|
157
|
+
"expectValidParts"
|
|
158
|
+
]
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"id": "testkit/reference/index/expectValidPresets",
|
|
162
|
+
"title": "expectValidPresets",
|
|
163
|
+
"summary": "Checks preset metadata. Validate domain assertions through the generation test runner.",
|
|
164
|
+
"path": "reference/index/expectValidPresets.md",
|
|
165
|
+
"importPath": "@metamesh/testkit",
|
|
166
|
+
"availability": "Local Node testing",
|
|
167
|
+
"canonical": "https://metamesh.studio/docs/develop/agent-authoring#test-models",
|
|
168
|
+
"keywords": [
|
|
169
|
+
"reference",
|
|
170
|
+
"index",
|
|
171
|
+
"expectValidPresets"
|
|
172
|
+
]
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"id": "testkit/reference/index/GeneratorTestExecution",
|
|
176
|
+
"title": "GeneratorTestExecution",
|
|
177
|
+
"summary": "GeneratorTestExecution exported from @metamesh/testkit.",
|
|
178
|
+
"path": "reference/index/GeneratorTestExecution.md",
|
|
179
|
+
"importPath": "@metamesh/testkit",
|
|
180
|
+
"availability": "Local Node testing",
|
|
181
|
+
"canonical": "https://metamesh.studio/docs/develop/agent-authoring#test-models",
|
|
182
|
+
"keywords": [
|
|
183
|
+
"reference",
|
|
184
|
+
"index",
|
|
185
|
+
"GeneratorTestExecution"
|
|
186
|
+
]
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"id": "testkit/reference/index/GeneratorTestRunner",
|
|
190
|
+
"title": "GeneratorTestRunner",
|
|
191
|
+
"summary": "GeneratorTestRunner exported from @metamesh/testkit.",
|
|
192
|
+
"path": "reference/index/GeneratorTestRunner.md",
|
|
193
|
+
"importPath": "@metamesh/testkit",
|
|
194
|
+
"availability": "Local Node testing",
|
|
195
|
+
"canonical": "https://metamesh.studio/docs/develop/agent-authoring#test-models",
|
|
196
|
+
"keywords": [
|
|
197
|
+
"reference",
|
|
198
|
+
"index",
|
|
199
|
+
"GeneratorTestRunner"
|
|
200
|
+
]
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
"id": "testkit/reference/index/GeneratorTestRunnerOptions",
|
|
204
|
+
"title": "GeneratorTestRunnerOptions",
|
|
205
|
+
"summary": "Fixed host resources and optional asynchronous asset preparation.",
|
|
206
|
+
"path": "reference/index/GeneratorTestRunnerOptions.md",
|
|
207
|
+
"importPath": "@metamesh/testkit",
|
|
208
|
+
"availability": "Local Node testing",
|
|
209
|
+
"canonical": "https://metamesh.studio/docs/develop/agent-authoring#test-models",
|
|
210
|
+
"keywords": [
|
|
211
|
+
"reference",
|
|
212
|
+
"index",
|
|
213
|
+
"GeneratorTestRunnerOptions"
|
|
214
|
+
]
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
"id": "testkit/reference/index/getTestEngine",
|
|
218
|
+
"title": "getTestEngine",
|
|
219
|
+
"summary": "Returns the shared test engine, initializing it only on first request. Runner construction does not call this function.",
|
|
220
|
+
"path": "reference/index/getTestEngine.md",
|
|
221
|
+
"importPath": "@metamesh/testkit",
|
|
222
|
+
"availability": "Local Node testing",
|
|
223
|
+
"canonical": "https://metamesh.studio/docs/develop/agent-authoring#test-models",
|
|
224
|
+
"keywords": [
|
|
225
|
+
"reference",
|
|
226
|
+
"index",
|
|
227
|
+
"getTestEngine"
|
|
228
|
+
]
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
"id": "testkit/reference/index/MeshMeasurementExpectation",
|
|
232
|
+
"title": "MeshMeasurementExpectation",
|
|
233
|
+
"summary": "Physical expectations for a closed mesh; omitted facts are not asserted.",
|
|
234
|
+
"path": "reference/index/MeshMeasurementExpectation.md",
|
|
235
|
+
"importPath": "@metamesh/testkit",
|
|
236
|
+
"availability": "Local Node testing",
|
|
237
|
+
"canonical": "https://metamesh.studio/docs/develop/agent-authoring#test-models",
|
|
238
|
+
"keywords": [
|
|
239
|
+
"reference",
|
|
240
|
+
"index",
|
|
241
|
+
"MeshMeasurementExpectation"
|
|
242
|
+
]
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
"id": "testkit/reference/index/MeshMeasurementTolerances",
|
|
246
|
+
"title": "MeshMeasurementTolerances",
|
|
247
|
+
"summary": "Absolute nonnegative comparison allowances; each omitted tolerance defaults to zero.",
|
|
248
|
+
"path": "reference/index/MeshMeasurementTolerances.md",
|
|
249
|
+
"importPath": "@metamesh/testkit",
|
|
250
|
+
"availability": "Local Node testing",
|
|
251
|
+
"canonical": "https://metamesh.studio/docs/develop/agent-authoring#test-models",
|
|
252
|
+
"keywords": [
|
|
253
|
+
"reference",
|
|
254
|
+
"index",
|
|
255
|
+
"MeshMeasurementTolerances"
|
|
256
|
+
]
|
|
257
|
+
}
|
|
258
|
+
]
|
|
259
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# LoadedFontFixtures
|
|
2
|
+
|
|
3
|
+
LoadedFontFixtures exported from @metamesh/testkit/font-fixtures.
|
|
4
|
+
|
|
5
|
+
Import from `@metamesh/testkit/font-fixtures` (@metamesh/testkit@0.13.0).
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
export interface LoadedFontFixtures {
|
|
9
|
+
readonly selections: readonly FontSelection[];
|
|
10
|
+
readonly prepareServices: (definition: GeneratorDefinition, parameters: Readonly<Record<string, unknown>>) => Promise<GeneratorServices>;
|
|
11
|
+
}
|
|
12
|
+
```
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# loadFontFixtureServices
|
|
2
|
+
|
|
3
|
+
Fixture provider matching createGeneratorTestRunner's asynchronous service boundary.
|
|
4
|
+
|
|
5
|
+
Import from `@metamesh/testkit/font-fixtures` (@metamesh/testkit@0.13.0).
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
/** Fixture provider matching createGeneratorTestRunner's asynchronous service boundary. */
|
|
9
|
+
export declare function loadFontFixtureServices(filename: string): Promise<LoadedFontFixtures["prepareServices"]>;
|
|
10
|
+
```
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# loadFontFixtures
|
|
2
|
+
|
|
3
|
+
Node-only local descriptor loader. Paths resolve beside the descriptor; bytes never come from a catalog.
|
|
4
|
+
|
|
5
|
+
Import from `@metamesh/testkit/font-fixtures` (@metamesh/testkit@0.13.0).
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
/** Node-only local descriptor loader. Paths resolve beside the descriptor; bytes never come from a catalog. */
|
|
9
|
+
export declare function loadFontFixtures(filename: string): Promise<LoadedFontFixtures>;
|
|
10
|
+
```
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# FontTestFixture
|
|
2
|
+
|
|
3
|
+
A checked-in immutable font fixture; no catalog or network is used by the test harness.
|
|
4
|
+
|
|
5
|
+
Import from `@metamesh/testkit/fonts` (@metamesh/testkit@0.13.0).
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
/** A checked-in immutable font fixture; no catalog or network is used by the test harness. */
|
|
9
|
+
export interface FontTestFixture {
|
|
10
|
+
/** Font face, weight and SHA-256 revision to resolve from these bytes. */
|
|
11
|
+
readonly selection: FontSelection;
|
|
12
|
+
/** Complete checked-in font file; its digest must match selection.revision. */
|
|
13
|
+
readonly bytes: Uint8Array<ArrayBuffer>;
|
|
14
|
+
/** Weight represented by a static face; omit for variable fonts. */
|
|
15
|
+
readonly staticWeight?: number;
|
|
16
|
+
}
|
|
17
|
+
```
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# prepareFontTestServices
|
|
2
|
+
|
|
3
|
+
Prepares the same synchronous text service used by Studio, from reproducible fixture bytes.
|
|
4
|
+
|
|
5
|
+
Import from `@metamesh/testkit/fonts` (@metamesh/testkit@0.13.0).
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
/** Prepares the same synchronous text service used by Studio, from reproducible fixture bytes. */
|
|
9
|
+
export declare function prepareFontTestServices(fixtures: readonly FontTestFixture[]): Promise<GeneratorServices>;
|
|
10
|
+
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# GeneratorTestExecution
|
|
2
|
+
|
|
3
|
+
GeneratorTestExecution exported from @metamesh/testkit.
|
|
4
|
+
|
|
5
|
+
Import from `@metamesh/testkit` (@metamesh/testkit@0.13.0).
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
export type GeneratorTestExecution<D extends GeneratorDefinition> = {
|
|
9
|
+
readonly type: "invalid";
|
|
10
|
+
readonly parameters: GeneratorParams<D>;
|
|
11
|
+
readonly validation: ParameterValidationResult;
|
|
12
|
+
} | {
|
|
13
|
+
readonly type: "generated";
|
|
14
|
+
readonly parameters: GeneratorParams<D>;
|
|
15
|
+
readonly validation: ParameterValidationResult;
|
|
16
|
+
readonly model: ModelSnapshot;
|
|
17
|
+
};
|
|
18
|
+
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# GeneratorTestRunner
|
|
2
|
+
|
|
3
|
+
GeneratorTestRunner exported from @metamesh/testkit.
|
|
4
|
+
|
|
5
|
+
Import from `@metamesh/testkit` (@metamesh/testkit@0.13.0).
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
export interface GeneratorTestRunner<D extends GeneratorDefinition> {
|
|
9
|
+
/** Checks declarations and assertions only. Set `normalize: false` to probe deliberately invalid typed values. */
|
|
10
|
+
readonly validate: (parameters: GeneratorParams<D>, options?: {
|
|
11
|
+
readonly normalize?: boolean;
|
|
12
|
+
}) => Promise<ParameterValidationResult>;
|
|
13
|
+
/** Normalizes once, prepares assets, and executes the same persistent session used by production hosts. */
|
|
14
|
+
readonly execute: (parameters: Readonly<Record<string, unknown>>) => Promise<GeneratorTestExecution<D>>;
|
|
15
|
+
/** Releases runner caches; separately owned snapshots remain valid. */
|
|
16
|
+
readonly dispose: () => void;
|
|
17
|
+
}
|
|
18
|
+
```
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# GeneratorTestRunnerOptions
|
|
2
|
+
|
|
3
|
+
Fixed host resources and optional asynchronous asset preparation.
|
|
4
|
+
|
|
5
|
+
Import from `@metamesh/testkit` (@metamesh/testkit@0.13.0).
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
/** Fixed host resources and optional asynchronous asset preparation. */
|
|
9
|
+
export interface GeneratorTestRunnerOptions<D extends GeneratorDefinition> {
|
|
10
|
+
readonly prepareServices?: (definition: D, parameters: GeneratorParams<D>) => GeneratorServices | Promise<GeneratorServices>;
|
|
11
|
+
readonly engine?: ModelEngine;
|
|
12
|
+
readonly limits?: Partial<ModelingLimits>;
|
|
13
|
+
}
|
|
14
|
+
```
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# MeshMeasurementExpectation
|
|
2
|
+
|
|
3
|
+
Physical expectations for a closed mesh; omitted facts are not asserted.
|
|
4
|
+
|
|
5
|
+
Import from `@metamesh/testkit` (@metamesh/testkit@0.13.0).
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
/** Physical expectations for a closed mesh; omitted facts are not asserted. */
|
|
9
|
+
export interface MeshMeasurementExpectation {
|
|
10
|
+
/** Axis-aligned XYZ bounds in millimetres. */
|
|
11
|
+
readonly bounds?: Bounds3;
|
|
12
|
+
/** Oriented enclosed volume in cubic millimetres; outward winding is positive. */
|
|
13
|
+
readonly signedVolume?: number;
|
|
14
|
+
/** Sum of triangle areas in square millimetres. */
|
|
15
|
+
readonly surfaceArea?: number;
|
|
16
|
+
/** Exact number of components connected by indexed mesh edges. */
|
|
17
|
+
readonly connectedComponentCount?: number;
|
|
18
|
+
}
|
|
19
|
+
```
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# MeshMeasurementTolerances
|
|
2
|
+
|
|
3
|
+
Absolute nonnegative comparison allowances; each omitted tolerance defaults to zero.
|
|
4
|
+
|
|
5
|
+
Import from `@metamesh/testkit` (@metamesh/testkit@0.13.0).
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
/** Absolute nonnegative comparison allowances; each omitted tolerance defaults to zero. */
|
|
9
|
+
export interface MeshMeasurementTolerances {
|
|
10
|
+
/** Allowance for each minimum/maximum XYZ coordinate in millimetres. */
|
|
11
|
+
readonly bounds?: number;
|
|
12
|
+
/** Allowance for signed volume in cubic millimetres. */
|
|
13
|
+
readonly signedVolume?: number;
|
|
14
|
+
/** Allowance for surface area in square millimetres. */
|
|
15
|
+
readonly surfaceArea?: number;
|
|
16
|
+
}
|
|
17
|
+
```
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# createGeneratorTestRunner
|
|
2
|
+
|
|
3
|
+
Creates a lazy runner for one generation program without loading assets or an engine.
|
|
4
|
+
|
|
5
|
+
Import from `@metamesh/testkit` (@metamesh/testkit@0.13.0).
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
/** Creates a lazy runner for one generation program without loading assets or an engine. */
|
|
9
|
+
export declare function createGeneratorTestRunner<const D extends GeneratorDefinition>(definition: D, runtime: {
|
|
10
|
+
readonly generate: ModelProgram<GeneratorParams<D>, GeneratorServices>;
|
|
11
|
+
}, options?: GeneratorTestRunnerOptions<NoInfer<D>>): GeneratorTestRunner<D>;
|
|
12
|
+
```
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# expectMeshMeasurements
|
|
2
|
+
|
|
3
|
+
Analyzes current buffers, requires closed oriented edge topology, and checks selected physical facts with explicit absolute tolerances. Returns fresh measurements without initializing an engine. These facts do not prove geometric equivalence or absence of self-intersections.
|
|
4
|
+
|
|
5
|
+
Import from `@metamesh/testkit` (@metamesh/testkit@0.13.0).
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
/**
|
|
9
|
+
* Analyzes current buffers, requires closed oriented edge topology, and checks selected physical
|
|
10
|
+
* facts with explicit absolute tolerances. Returns fresh measurements without initializing an
|
|
11
|
+
* engine. These facts do not prove geometric equivalence or absence of self-intersections.
|
|
12
|
+
*/
|
|
13
|
+
export declare function expectMeshMeasurements(mesh: TriangleMesh, expected: MeshMeasurementExpectation, tolerances?: MeshMeasurementTolerances): TriangleMeshAnalysis;
|
|
14
|
+
```
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# expectSerializableDefinition
|
|
2
|
+
|
|
3
|
+
Throws unless a definition already has the canonical package-serializable representation.
|
|
4
|
+
|
|
5
|
+
Import from `@metamesh/testkit` (@metamesh/testkit@0.13.0).
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
/** Throws unless a definition already has the canonical package-serializable representation. */
|
|
9
|
+
export declare function expectSerializableDefinition(definition: GeneratorDefinition): void;
|
|
10
|
+
```
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# expectValidDefaults
|
|
2
|
+
|
|
3
|
+
Throws unless defaults strictly decode and equal the defaults derived from the definition.
|
|
4
|
+
|
|
5
|
+
Import from `@metamesh/testkit` (@metamesh/testkit@0.13.0).
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
/** Throws unless defaults strictly decode and equal the defaults derived from the definition. */
|
|
9
|
+
export declare function expectValidDefaults<const D extends GeneratorDefinition>(definition: D, defaults: GeneratorParams<D>): void;
|
|
10
|
+
```
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# expectValidParts
|
|
2
|
+
|
|
3
|
+
Checks finalized engine parts after omitting measurement facts from their strict wire DTOs. Runs mesh reconstruction/finalization synchronously using the supplied engine. Strictly checks unknown wire data and reconstructs its meshes using the supplied engine. Initializes the shared test engine lazily, then applies the same wire and mesh checks.
|
|
4
|
+
|
|
5
|
+
Import from `@metamesh/testkit` (@metamesh/testkit@0.13.0).
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
/**
|
|
9
|
+
* Checks finalized engine parts after omitting measurement facts from their strict wire DTOs.
|
|
10
|
+
* Runs mesh reconstruction/finalization synchronously using the supplied engine.
|
|
11
|
+
*/
|
|
12
|
+
export declare function expectValidParts(value: readonly FinalizedPart[], engine: ModelEngine): readonly GeneratedPart[];
|
|
13
|
+
|
|
14
|
+
/** Strictly checks unknown wire data and reconstructs its meshes using the supplied engine. */
|
|
15
|
+
export declare function expectValidParts(value: unknown, engine: ModelEngine): readonly GeneratedPart[];
|
|
16
|
+
|
|
17
|
+
/** Initializes the shared test engine lazily, then applies the same wire and mesh checks. */
|
|
18
|
+
export declare function expectValidParts(value: unknown): Promise<readonly GeneratedPart[]>;
|
|
19
|
+
```
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# expectValidPresets
|
|
2
|
+
|
|
3
|
+
Checks preset metadata. Validate domain assertions through the generation test runner.
|
|
4
|
+
|
|
5
|
+
Import from `@metamesh/testkit` (@metamesh/testkit@0.13.0).
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
/** Checks preset metadata. Validate domain assertions through the generation test runner. */
|
|
9
|
+
export declare function expectValidPresets<const D extends GeneratorDefinition>(definition: D, presets: readonly GeneratorPreset<D>[]): void;
|
|
10
|
+
```
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# getTestEngine
|
|
2
|
+
|
|
3
|
+
Returns the shared test engine, initializing it only on first request. Runner construction does not call this function.
|
|
4
|
+
|
|
5
|
+
Import from `@metamesh/testkit` (@metamesh/testkit@0.13.0).
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
/**
|
|
9
|
+
* Returns the shared test engine, initializing it only on first request.
|
|
10
|
+
* Runner construction does not call this function.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getTestEngine(): Promise<ModelEngine>;
|
|
13
|
+
```
|
package/dist/engine.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ModelEngine } from "@metamesh/modeling/engine";
|
|
2
|
+
/**
|
|
3
|
+
* Returns the shared test engine, initializing it only on first request.
|
|
4
|
+
* Runner construction does not call this function.
|
|
5
|
+
*/
|
|
6
|
+
export declare function getTestEngine(): Promise<ModelEngine>;
|
|
7
|
+
//# sourceMappingURL=engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAIhF;;;GAGG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAAC,WAAW,CAAC,CAGpD"}
|
package/dist/engine.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createModelEngine } from "@metamesh/modeling/engine";
|
|
2
|
+
let testEngine;
|
|
3
|
+
/**
|
|
4
|
+
* Returns the shared test engine, initializing it only on first request.
|
|
5
|
+
* Runner construction does not call this function.
|
|
6
|
+
*/
|
|
7
|
+
export function getTestEngine() {
|
|
8
|
+
testEngine ??= createModelEngine();
|
|
9
|
+
return testEngine;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=engine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAoB,MAAM,2BAA2B,CAAC;AAEhF,IAAI,UAA4C,CAAC;AAEjD;;;GAGG;AACH,MAAM,UAAU,aAAa;IAC3B,UAAU,KAAK,iBAAiB,EAAE,CAAC;IACnC,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type FontSelection, type GeneratorDefinition, type GeneratorServices } from "@metamesh/generator-sdk";
|
|
2
|
+
export interface LoadedFontFixtures {
|
|
3
|
+
readonly selections: readonly FontSelection[];
|
|
4
|
+
readonly prepareServices: (definition: GeneratorDefinition, parameters: Readonly<Record<string, unknown>>) => Promise<GeneratorServices>;
|
|
5
|
+
}
|
|
6
|
+
/** Node-only local descriptor loader. Paths resolve beside the descriptor; bytes never come from a catalog. */
|
|
7
|
+
export declare function loadFontFixtures(filename: string): Promise<LoadedFontFixtures>;
|
|
8
|
+
/** Fixture provider matching createGeneratorTestRunner's asynchronous service boundary. */
|
|
9
|
+
export declare function loadFontFixtureServices(filename: string): Promise<LoadedFontFixtures["prepareServices"]>;
|
|
10
|
+
//# sourceMappingURL=font-fixtures.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"font-fixtures.d.ts","sourceRoot":"","sources":["../src/font-fixtures.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACvB,MAAM,yBAAyB,CAAC;AAIjC,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,UAAU,EAAE,SAAS,aAAa,EAAE,CAAC;IAC9C,QAAQ,CAAC,eAAe,EAAE,CACxB,UAAU,EAAE,mBAAmB,EAC/B,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,KAC1C,OAAO,CAAC,iBAAiB,CAAC,CAAC;CACjC;AAED,+GAA+G;AAC/G,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAiEpF;AAED,2FAA2F;AAC3F,wBAAsB,uBAAuB,CAC3C,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,CAAC,CAEhD"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { dirname, resolve } from "node:path";
|
|
3
|
+
import { isFontSelection, } from "@metamesh/generator-sdk";
|
|
4
|
+
import { prepareFontTestServices } from "./fonts.js";
|
|
5
|
+
/** Node-only local descriptor loader. Paths resolve beside the descriptor; bytes never come from a catalog. */
|
|
6
|
+
export async function loadFontFixtures(filename) {
|
|
7
|
+
const source = resolve(filename);
|
|
8
|
+
const descriptors = JSON.parse(await readFile(source, "utf8"));
|
|
9
|
+
if (!Array.isArray(descriptors) || descriptors.length === 0 || descriptors.length > 100)
|
|
10
|
+
throw new Error("Font fixtures must be a JSON array of 1–100 local fixture descriptors.");
|
|
11
|
+
const fixtures = new Map();
|
|
12
|
+
const prepared = new Map();
|
|
13
|
+
const selectionKey = (selection) => `${selection.faceId}@${selection.revision}:${selection.weight}`;
|
|
14
|
+
for (const value of descriptors) {
|
|
15
|
+
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
16
|
+
throw new Error("Invalid local font fixture descriptor.");
|
|
17
|
+
const descriptor = value;
|
|
18
|
+
if (Object.keys(descriptor).some((key) => !["selection", "file", "staticWeight"].includes(key)) ||
|
|
19
|
+
!isFontSelection(descriptor.selection) ||
|
|
20
|
+
typeof descriptor.file !== "string" ||
|
|
21
|
+
descriptor.file.length === 0 ||
|
|
22
|
+
(descriptor.staticWeight !== undefined &&
|
|
23
|
+
(typeof descriptor.staticWeight !== "number" ||
|
|
24
|
+
!Number.isInteger(descriptor.staticWeight) ||
|
|
25
|
+
descriptor.staticWeight < 1 ||
|
|
26
|
+
descriptor.staticWeight > 1000)))
|
|
27
|
+
throw new Error("Each font fixture requires selection, a local file path, and optional staticWeight.");
|
|
28
|
+
const key = selectionKey(descriptor.selection);
|
|
29
|
+
if (fixtures.has(key))
|
|
30
|
+
throw new Error("Font fixtures contain a duplicate selection.");
|
|
31
|
+
const bytes = new Uint8Array(await readFile(resolve(dirname(source), descriptor.file)));
|
|
32
|
+
const digest = Buffer.from(await crypto.subtle.digest("SHA-256", bytes)).toString("hex");
|
|
33
|
+
if (digest !== descriptor.selection.revision)
|
|
34
|
+
throw new Error("The font fixture does not match its immutable revision.");
|
|
35
|
+
fixtures.set(key, {
|
|
36
|
+
selection: descriptor.selection,
|
|
37
|
+
bytes,
|
|
38
|
+
...(descriptor.staticWeight === undefined ? {} : { staticWeight: descriptor.staticWeight }),
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
selections: [...fixtures.values()].map(({ selection }) => selection),
|
|
43
|
+
async prepareServices(definition, parameters) {
|
|
44
|
+
const selected = new Map();
|
|
45
|
+
for (const parameter of definition.parameters.filter(({ type }) => type === "font")) {
|
|
46
|
+
const selection = parameters[parameter.id];
|
|
47
|
+
if (!isFontSelection(selection))
|
|
48
|
+
throw new Error(`Invalid font parameter ${parameter.id}.`);
|
|
49
|
+
const key = selectionKey(selection);
|
|
50
|
+
const fixture = fixtures.get(key);
|
|
51
|
+
if (fixture === undefined)
|
|
52
|
+
throw new Error(`Missing local font fixture for ${key}.`);
|
|
53
|
+
selected.set(key, fixture);
|
|
54
|
+
}
|
|
55
|
+
const keys = [...selected.keys()].sort();
|
|
56
|
+
const cacheKey = JSON.stringify(keys);
|
|
57
|
+
let pending = prepared.get(cacheKey);
|
|
58
|
+
if (pending === undefined) {
|
|
59
|
+
pending = prepareFontTestServices(keys.map((key) => selected.get(key)));
|
|
60
|
+
prepared.set(cacheKey, pending);
|
|
61
|
+
const captured = pending;
|
|
62
|
+
void pending.catch(() => {
|
|
63
|
+
if (prepared.get(cacheKey) === captured)
|
|
64
|
+
prepared.delete(cacheKey);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
return pending;
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
/** Fixture provider matching createGeneratorTestRunner's asynchronous service boundary. */
|
|
72
|
+
export async function loadFontFixtureServices(filename) {
|
|
73
|
+
return (await loadFontFixtures(filename)).prepareServices;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=font-fixtures.js.map
|