Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/thatdeveloperguy-website / tests/unit/rive-plan.test.ts |
| Date | Not specified in source |
| Repository | Janady13/thatdeveloperguy-website |
| Revision | 2bea2ebdff0e34494bff597d4fa9c8422a0c3a94 |
| Branch | main |
| Path or archive member | tests/unit/rive-plan.test.ts |
| Original SHA-256 | caea50f7fb0e059114fda8093f19ab901f2a7a10dac0cfa3aa6f0010acd695cc |
| Git blob SHA | 311a4f6cf5f83d125f659718f7be61bf0e684856 |
| Reading-copy SHA-256 | caea50f7fb0e059114fda8093f19ab901f2a7a10dac0cfa3aa6f0010acd695cc |
Recovered source transcript
Download complete source text ↓26 lines · 1.9 KB
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
import { planRoom } from '../../tools/rive-plan.ts';
const lobby = JSON.parse(readFileSync(new URL('../../creative-source/refined/lobby/manifest.json', import.meta.url), 'utf8'));
test('the lobby plan names three doors with hinges at the package pivots and hotspots that carry the site page ids', () => {
const plan = planRoom(lobby);
assert.equal(plan.artboard, 'Lobby');
assert.deepEqual(plan.doors.map(d => [d.id, d.hinge, d.trigger]), [['Door_IT', [564, 529], 'openDoor_IT'], ['Door_Gov', [804, 529], 'openDoor_Gov'], ['Door_Cyber', [1049, 529], 'openDoor_Cyber']]);
assert.deepEqual(plan.hotspots.map(h => [h.id, h.pageId, h.trigger]), [['door-IT', 'capability.business-it', 'openDoor_IT'], ['door-Gov', 'audience.government', 'openDoor_Gov'], ['door-Cyber', 'capability.cybersecurity', 'openDoor_Cyber'], ['reception', 'contact', null], ['lounge', 'company', null]]);
assert.deepEqual(plan.enum.values, ['none', 'door-IT', 'door-Gov', 'door-Cyber', 'reception', 'lounge']);
});
test('every door layer enters Closed and opens on its trigger; focus is driven from Any State', () => {
const plan = planRoom(lobby);
const door = plan.layers.find(l => l.name === 'Door_Door_IT')!;
assert.deepEqual(door.transitions, [{ from: '{Entry State}', to: 'Closed' }, { from: 'Closed', to: 'Open', when: { property: 'openDoor_IT' } }]);
const open = plan.animations.find(a => a.name === 'DoorOpen_Door_IT')!;
assert.equal(open.loop, 'oneShot');
assert.deepEqual(open.keys.slice(0, 2).map(k => [k.target, k.property, k.frame, k.value]), [['pivot:door_it_leaf', 'scaleX', 0, 100], ['pivot:door_it_leaf', 'scaleX', 26, 35]]);
const focus = plan.layers.find(l => l.name === 'Focus')!;
assert.ok(focus.transitions.some(t => t.from === '{Any State}' && t.to === 'Focus_door-Gov' && t.when?.equals === 'door-Gov'));
});