Skip to content
Merged
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { describe, expect, it } from 'vitest';

import { ORCHESTRATOR_POSES } from '../orchestrator-poses.ts';

describe('ORCHESTRATOR_POSES', () => {
it('exports exactly 12 poses', () => {
expect(ORCHESTRATOR_POSES).toHaveLength(12);
});

it('every pixel index is within 0-6 (palette range including beacon bright)', () => {
for (const [poseIndex, pose] of ORCHESTRATOR_POSES.entries()) {
for (const [partIndex, part] of pose.entries()) {
for (const [rowIndex, row] of part.pixels.entries()) {
for (const [colIndex, value] of row.entries()) {
expect(
value,
`pose ${poseIndex}, part ${partIndex}, row ${rowIndex}, col ${colIndex}: value ${value} out of range`,
).toBeGreaterThanOrEqual(0);
expect(
value,
`pose ${poseIndex}, part ${partIndex}, row ${rowIndex}, col ${colIndex}: value ${value} out of range`,
).toBeLessThanOrEqual(6);
}
}
}
}
});

it('every pose has treads at offsetY 26 (bottom-anchored)', () => {
for (const [index, pose] of ORCHESTRATOR_POSES.entries()) {
const treadPart = pose[0];
expect(treadPart?.offsetY, `pose ${index} treads not at row 26`).toBe(26);
}
});

it('beacon on frames use palette index 6', () => {
// Frame 4 (Working 1) should have beacon with index 6 pixels
const beaconPart = ORCHESTRATOR_POSES[4]?.[5]; // last part = beacon
expect(beaconPart).toBeDefined();
const hasIndex6 = beaconPart?.pixels.some((row) => row.includes(6)) ?? false;
expect(hasIndex6).toBe(true);
});
});
17 changes: 17 additions & 0 deletions packages/factory/scripts/sprites/__tests__/palettes.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { describe, expect, it } from 'vitest';

import { ORCHESTRATOR_PALETTE, SUBAGENT_PALETTE } from '../palettes.ts';

describe('ORCHESTRATOR_PALETTE', () => {
it('has 7 entries (transparent + 5 shades + beacon bright)', () => {
expect(ORCHESTRATOR_PALETTE).toHaveLength(7);
expect(ORCHESTRATOR_PALETTE[0]).toBe('');
expect(ORCHESTRATOR_PALETTE[6]).toBe('#fff5c0');
});
});

describe('SUBAGENT_PALETTE', () => {
it('has 6 entries (transparent + 5 shades) and is unchanged', () => {
expect(SUBAGENT_PALETTE).toHaveLength(6);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ describe('pose data integrity', () => {
}
});

it('all orchestrator pixel values are within the valid palette range [0, 5]', () => {
it('all orchestrator pixel values are within the valid palette range [0, 6]', () => {
for (const [poseIndex, pose] of ORCHESTRATOR_POSES.entries()) {
for (const [partIndex, part] of pose.entries()) {
for (const [rowIndex, row] of part.pixels.entries()) {
Expand All @@ -288,7 +288,7 @@ describe('pose data integrity', () => {
expect(
value,
`orchestrator pose ${poseIndex}, part ${partIndex}, row ${rowIndex}, col ${colIndex}: value ${value} out of range`,
).toBeLessThanOrEqual(5);
).toBeLessThanOrEqual(6);
}
}
}
Expand Down
Loading
Loading