import { describe, expect, it } from 'vitest'; import { VOLTAGE } from '../../src/scenes/floor/venueMap'; import { DEFAULT_LAYOUT, LAYOUTS, layoutFor } from '../../src/scenes/floor/layouts'; import { VENUES } from '../../src/data/venues'; import { assertLayout } from './layoutInvariants'; // Voltage is the reference room — it shipped, it is tuned, and its // reachability was already asserted the long way round in venueMap.test.ts. // Running it through the shared rulebook proves the rulebook, not the room: if // assertLayout is wrong, it is wrong HERE first, before three new layouts are // authored against it. describe('VOLTAGE layout', () => { it('satisfies the shared venue invariants', () => { assertLayout(VOLTAGE, { bar: 6, dance: 8, booth: 4, toilet: 4, smoke: 1, entry: 1, exit: 1 }); }); }); describe('the layout registry', () => { // layoutFor() falls back to Voltage on an unknown id so the dev routes can // boot the floor with no night at all. That kindness also means a venue whose // room was never built fails SILENTLY — you would play a week at "Elevate" // in Voltage's room and the only symptom is a nagging sense of déjà vu. it('has a room for every venue in the ladder', () => { for (const venue of VENUES) { const layout = layoutFor(venue.id); expect(layout.id, `venue '${venue.id}' has no layout of its own`).toBe(venue.id); } }); it('has no layout without a venue, and no duplicate ids', () => { const venueIds = new Set(VENUES.map((v) => v.id)); const seen = new Set(); for (const layout of LAYOUTS) { expect(venueIds.has(layout.id), `layout '${layout.id}' belongs to no venue`).toBe(true); expect(seen.has(layout.id), `duplicate layout id '${layout.id}'`).toBe(false); seen.add(layout.id); } }); it('falls back to the tuned reference room, not to nothing', () => { expect(layoutFor(undefined)).toBe(DEFAULT_LAYOUT); expect(layoutFor('a venue that does not exist')).toBe(DEFAULT_LAYOUT); expect(DEFAULT_LAYOUT).toBe(VOLTAGE); }); it('gives every room the stations the floor scene needs', () => { // FloorDemoScene resolves the playable shifts from these names. A layout // missing one silently parks that station in the middle of the map. for (const layout of LAYOUTS) { for (const post of ['taps', 'decks']) { expect(layout.posts[post], `${layout.id} has no '${post}' post`).toBeDefined(); } for (const probe of ['tapsFront', 'rack', 'dishwasher', 'water']) { expect(layout.probes[probe], `${layout.id} has no '${probe}' probe`).toBeDefined(); } } }); });