test(pleno-vue): snapshot-lock SELF_SERVE_TASK_BUTTON_OPTIONS shape (TRU-19) (#316)
Adds a snapshot test that locks the full {id, name, description} triple for every entry in SELF_SERVE_TASK_BUTTON_OPTIONS. The previous test only checked counts and that the ids were sequential; this test catches reordering, renames, and unexpected entries as well.
The wash bay exposes 12 programs and 3 special buttons (reset / program picker / start). The dashboard renders one entry per program number from this array, so the entire array must remain exactly 15 entries long.
Test result: 10/10 vitest passed (was 9, +1 new snapshot test)
Refs TRU-19
This commit is contained in:
@@ -129,4 +129,43 @@ describe("selfServeDynamicImage", () => {
|
||||
expect(specialIds.has(SELF_SERVE_TASK_BUTTON_PROGRAM_PICKER)).toBe(true);
|
||||
expect(specialIds.has(SELF_SERVE_TASK_BUTTON_START)).toBe(true);
|
||||
});
|
||||
|
||||
// Snapshot lock for the full button-registry shape (TRU-19).
|
||||
//
|
||||
// The wash bay exposes 12 programs and 3 special buttons (reset / program
|
||||
// picker / start). The dashboard renders one entry per program number
|
||||
// from SELF_SERVE_TASK_BUTTON_OPTIONS, so the entire array must remain
|
||||
// exactly 15 entries long: 1 reset + 1 program picker + 12 numeric
|
||||
// programs (ids 0-11) + 1 start.
|
||||
//
|
||||
// If anyone adds, removes, or reorders entries without thinking about
|
||||
// the operator UI and the api mapping, this snapshot will fail and
|
||||
// force a deliberate update. The user-facing program names ("FF Uvs",
|
||||
// "10min", "SF", etc.) live on the wash bay hardware and are NOT in
|
||||
// this array — see TRU-19 and api SelfserveProgramRegistryContractTest.
|
||||
it("locks the full SELF_SERVE_TASK_BUTTON_OPTIONS shape as a snapshot (15 entries, fixed order)", () => {
|
||||
// Exact total length: 1 reset + 1 program picker + 12 programs + 1 start = 15
|
||||
expect(SELF_SERVE_TASK_BUTTON_OPTIONS).toHaveLength(15);
|
||||
|
||||
// Full structural snapshot. The {id, name, description} triples must
|
||||
// remain exactly as below. If you change one, change them all here
|
||||
// deliberately.
|
||||
expect(SELF_SERVE_TASK_BUTTON_OPTIONS.map((entry) => [entry.id, entry.name, entry.description])).toEqual([
|
||||
[SELF_SERVE_TASK_BUTTON_RESET, "Reset", "Reset button"],
|
||||
[SELF_SERVE_TASK_BUTTON_PROGRAM_PICKER, "Program picker", "Program picker wheel"],
|
||||
[0, "Program 1", "Machine button 0"],
|
||||
[1, "Program 2", "Machine button 1"],
|
||||
[2, "Program 3", "Machine button 2"],
|
||||
[3, "Program 4", "Machine button 3"],
|
||||
[4, "Program 5", "Machine button 4"],
|
||||
[5, "Program 6", "Machine button 5"],
|
||||
[6, "Program 7", "Machine button 6"],
|
||||
[7, "Program 8", "Machine button 7"],
|
||||
[8, "Program 9", "Machine button 8"],
|
||||
[9, "Program 10", "Machine button 9"],
|
||||
[10, "Program 11", "Machine button 10"],
|
||||
[11, "Program 12", "Machine button 11"],
|
||||
[SELF_SERVE_TASK_BUTTON_START, "Start", "Start button"],
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user