static-shards.spec.ts 852 B

12345678910111213141516
  1. import { describe, expect, it } from 'vitest'
  2. import { selectStaticGates, staticShards } from './static-shards.ts'
  3. const completeInventory = staticShards.flatMap(shard => shard.gateIds).map(id => ({ id }))
  4. describe('static gate shards', () => {
  5. it.each(staticShards)('selects only the gates owned by $name', (shard) => {
  6. expect(selectStaticGates(completeInventory, shard.name).map(gate => gate.id)).toEqual(shard.gateIds)
  7. })
  8. it('rejects missing, duplicate, and unknown assignments', () => {
  9. expect(() => selectStaticGates(completeInventory.slice(1))).toThrow('assign every static gate exactly once')
  10. expect(() => selectStaticGates([...completeInventory, completeInventory[0]!])).toThrow('static gate IDs must be unique')
  11. expect(() => selectStaticGates(completeInventory, 'missing')).toThrow('unknown DSH_STATIC_SHARD')
  12. })
  13. })