@vmz/test 0.0.3 → 0.0.4
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/browser.js +1 -1
- package/dist/compile.js +77 -2
- package/dist/deployment.js +1 -1
- package/dist/logic.js +14 -3
- package/dist/resume.js +2 -2
- package/dist/ssr.js +1 -1
- package/package.json +3 -3
package/dist/browser.js
CHANGED
|
@@ -526,7 +526,7 @@ export async function runBrowserManifest(manifest, ctx) {
|
|
|
526
526
|
}
|
|
527
527
|
continue;
|
|
528
528
|
}
|
|
529
|
-
if (kind === 'graph' || kind === 'plan' || kind === 'diagnostic' || kind === 'view') {
|
|
529
|
+
if (kind === 'graph' || kind === 'plan' || kind === 'diagnostic' || kind === 'view' || kind === 'motion') {
|
|
530
530
|
continue;
|
|
531
531
|
}
|
|
532
532
|
fail(`unknown browser assertion ${JSON.stringify(kind)}`);
|
package/dist/compile.js
CHANGED
|
@@ -248,8 +248,13 @@ export function runCompileManifest(manifest, ctx) {
|
|
|
248
248
|
if (expect.create === true && !clientJs.includes('__vmzCreate')) {
|
|
249
249
|
fail('missing __vmzCreate');
|
|
250
250
|
}
|
|
251
|
-
if (expect.plan === true
|
|
252
|
-
|
|
251
|
+
if (expect.plan === true) {
|
|
252
|
+
// Plan identity is *.program.json; client `__vmzPlan` embed is opt-in (VMZ_EMIT_PLAN).
|
|
253
|
+
const hasClientPlan = clientJs.includes('__vmzPlan');
|
|
254
|
+
const hasProgramPlan = typeof prog.schema === 'string' || Boolean(arts.programPath) || Boolean(plan);
|
|
255
|
+
if (!hasClientPlan && !hasProgramPlan) {
|
|
256
|
+
fail('missing plan (client __vmzPlan or *.program.json)');
|
|
257
|
+
}
|
|
253
258
|
}
|
|
254
259
|
if (expect.serialize === true && !clientJs.includes('__vmzSerialize')) {
|
|
255
260
|
fail('missing __vmzSerialize');
|
|
@@ -400,6 +405,76 @@ export function runCompileManifest(manifest, ctx) {
|
|
|
400
405
|
}
|
|
401
406
|
continue;
|
|
402
407
|
}
|
|
408
|
+
if (kind === 'motion') {
|
|
409
|
+
const motion = unit.motion || null;
|
|
410
|
+
const transitions = motion?.transitions || [];
|
|
411
|
+
const edges = unit.graph?.edges || [];
|
|
412
|
+
if (expect.status != null) {
|
|
413
|
+
if (!motion || motion.status !== expect.status) {
|
|
414
|
+
fail(`motion.status want ${expect.status}, got ${motion?.status}`);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
if (expect.nonEmpty === true && transitions.length === 0) {
|
|
418
|
+
fail('motion.transitions empty');
|
|
419
|
+
}
|
|
420
|
+
if (Array.isArray(expect.kinds)) {
|
|
421
|
+
const have = new Set(transitions.map((t) => String(t.kind || '')));
|
|
422
|
+
for (const k of expect.kinds) {
|
|
423
|
+
if (!have.has(String(k)))
|
|
424
|
+
fail(`motion missing kind=${k}: ${[...have]}`);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
if (typeof expect.token === 'string') {
|
|
428
|
+
if (!transitions.some((t) => t.token === expect.token)) {
|
|
429
|
+
fail(`motion missing token=${expect.token}: ${JSON.stringify(transitions)}`);
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
if (Array.isArray(expect.tokens)) {
|
|
433
|
+
for (const tok of expect.tokens) {
|
|
434
|
+
if (!transitions.some((t) => t.token === tok)) {
|
|
435
|
+
fail(`motion missing token=${tok}: ${JSON.stringify(transitions)}`);
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
if (expect.cancelable === true) {
|
|
440
|
+
if (!transitions.some((t) => t.cancelable === true)) {
|
|
441
|
+
fail(`motion missing cancelable transition: ${JSON.stringify(transitions)}`);
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
if (expect.generation === true) {
|
|
445
|
+
if (!transitions.some((t) => t.generation === true)) {
|
|
446
|
+
fail(`motion missing generation transition: ${JSON.stringify(transitions)}`);
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
if (typeof expect.reducedMotion === 'string') {
|
|
450
|
+
if (!transitions.every((t) => t.reduced_motion === expect.reducedMotion)) {
|
|
451
|
+
fail(`motion.reduced_motion want ${expect.reducedMotion}: ${JSON.stringify(transitions)}`);
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
if (expect.hasRegion === true) {
|
|
455
|
+
if (!transitions.some((t) => t.region != null)) {
|
|
456
|
+
fail(`motion missing region on transitions: ${JSON.stringify(transitions)}`);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
if (expect.affectsRegion === true) {
|
|
460
|
+
const hit = edges.some((e) => e.kind === 'affects' && String(e.from).startsWith('motion:') && String(e.to).startsWith('region:'));
|
|
461
|
+
if (!hit)
|
|
462
|
+
fail(`missing motion→region affects edges: ${JSON.stringify(edges.filter((e) => String(e.from).startsWith('motion:')))}`);
|
|
463
|
+
}
|
|
464
|
+
if (Array.isArray(expect.cancelsFrom)) {
|
|
465
|
+
for (const from of expect.cancelsFrom) {
|
|
466
|
+
const hit = edges.some((e) => e.kind === 'cancels' && e.from === from && String(e.to).startsWith('motion:'));
|
|
467
|
+
if (!hit)
|
|
468
|
+
fail(`missing cancels from ${from}: ${JSON.stringify(edges.filter((e) => e.kind === 'cancels'))}`);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
if (expect.planMotionTransition === true) {
|
|
472
|
+
const nodes = (plan?.nodes || []).filter((n) => n.kind === 'motion_transition');
|
|
473
|
+
if (!nodes.length)
|
|
474
|
+
fail('plan missing motion_transition nodes');
|
|
475
|
+
}
|
|
476
|
+
continue;
|
|
477
|
+
}
|
|
403
478
|
if (kind === 'deployment') {
|
|
404
479
|
const deployment = unit.deployment || null;
|
|
405
480
|
const entries = deployment?.resume_entries ||
|
package/dist/deployment.js
CHANGED
|
@@ -157,7 +157,7 @@ export function runDeploymentManifest(manifest, ctx) {
|
|
|
157
157
|
}
|
|
158
158
|
continue;
|
|
159
159
|
}
|
|
160
|
-
if (kind === 'graph' || kind === 'plan' || kind === 'diagnostic') {
|
|
160
|
+
if (kind === 'graph' || kind === 'plan' || kind === 'diagnostic' || kind === 'motion') {
|
|
161
161
|
continue;
|
|
162
162
|
}
|
|
163
163
|
fail(`unknown deployment assertion ${JSON.stringify(kind)}`);
|
package/dist/logic.js
CHANGED
|
@@ -206,8 +206,19 @@ function runOneAssertion(a, host, fail) {
|
|
|
206
206
|
return;
|
|
207
207
|
}
|
|
208
208
|
if (kind === 'domKeys') {
|
|
209
|
-
|
|
210
|
-
const
|
|
209
|
+
// Client Direct: `__vmzKey` expando. SSR HTML: `data-vmz-key` attr (expect.attr).
|
|
210
|
+
const attr = expect.attr != null ? String(expect.attr) : null;
|
|
211
|
+
const expando = expect.expando != null ? String(expect.expando) : attr ? null : '__vmzKey';
|
|
212
|
+
let keys = [];
|
|
213
|
+
if (attr) {
|
|
214
|
+
keys = [...host.app.querySelectorAll(`[${attr}]`)].map((el) => String(el.getAttribute(attr)));
|
|
215
|
+
}
|
|
216
|
+
else if (expando) {
|
|
217
|
+
keys = [...host.app.querySelectorAll('*')]
|
|
218
|
+
.map((el) => el[expando])
|
|
219
|
+
.filter((k) => k != null)
|
|
220
|
+
.map((k) => String(k));
|
|
221
|
+
}
|
|
211
222
|
if (Array.isArray(expect.includes)) {
|
|
212
223
|
for (const k of expect.includes) {
|
|
213
224
|
if (!keys.includes(String(k)))
|
|
@@ -234,7 +245,7 @@ function runOneAssertion(a, host, fail) {
|
|
|
234
245
|
}
|
|
235
246
|
return;
|
|
236
247
|
}
|
|
237
|
-
if (kind === 'graph' || kind === 'plan' || kind === 'diagnostic' || kind === 'view') {
|
|
248
|
+
if (kind === 'graph' || kind === 'plan' || kind === 'diagnostic' || kind === 'view' || kind === 'motion') {
|
|
238
249
|
return;
|
|
239
250
|
}
|
|
240
251
|
if (kind === 'assert') {
|
package/dist/resume.js
CHANGED
|
@@ -138,7 +138,7 @@ export async function runResumeManifest(manifest, ctx) {
|
|
|
138
138
|
}
|
|
139
139
|
island = el;
|
|
140
140
|
el.click();
|
|
141
|
-
// EventEntry resume is async via Promise.resolve(fn).
|
|
141
|
+
// EventEntry resume is async via Promise.resolve(fn()).
|
|
142
142
|
await Promise.resolve();
|
|
143
143
|
await Promise.resolve();
|
|
144
144
|
await new Promise((r) => setTimeout(r, Number(a.waitMs ?? 10)));
|
|
@@ -241,7 +241,7 @@ export async function runResumeManifest(manifest, ctx) {
|
|
|
241
241
|
}
|
|
242
242
|
continue;
|
|
243
243
|
}
|
|
244
|
-
if (kind === 'graph' || kind === 'plan' || kind === 'deployment' || kind === 'diagnostic') {
|
|
244
|
+
if (kind === 'graph' || kind === 'plan' || kind === 'deployment' || kind === 'diagnostic' || kind === 'motion') {
|
|
245
245
|
continue;
|
|
246
246
|
}
|
|
247
247
|
fail(`unknown resume assertion ${JSON.stringify(kind)}`);
|
package/dist/ssr.js
CHANGED
|
@@ -234,7 +234,7 @@ export async function runSsrManifest(manifest, ctx) {
|
|
|
234
234
|
}
|
|
235
235
|
continue;
|
|
236
236
|
}
|
|
237
|
-
if (kind === 'graph' || kind === 'plan' || kind === 'view' || kind === 'diagnostic') {
|
|
237
|
+
if (kind === 'graph' || kind === 'plan' || kind === 'view' || kind === 'diagnostic' || kind === 'motion') {
|
|
238
238
|
continue;
|
|
239
239
|
}
|
|
240
240
|
fail(`unknown ssr assertion ${JSON.stringify(kind)}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vmz/test",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "VMZ native test protocol + Compile/Logic/Browser/SSR/Resume/Deployment hosts",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"build": "tsc -p tsconfig.json"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@vmz/core": "0.0.
|
|
31
|
-
"@vmz/protocol": "0.0.
|
|
30
|
+
"@vmz/core": "0.0.4",
|
|
31
|
+
"@vmz/protocol": "0.0.4",
|
|
32
32
|
"linkedom": "^0.18.13",
|
|
33
33
|
"puppeteer-core": "^24.11.2"
|
|
34
34
|
},
|