assembly-plan.client.spec.ts 893 B

12345678910111213141516171819202122
  1. /** assertPlan: provide keys must name roster rows. */
  2. import { describe, expect, it } from 'vitest'
  3. import { assertPlan } from '../src/assembly/roster.ts'
  4. import { ClientRoster } from '../src/assembly/roster.ts'
  5. const roster = ClientRoster.of([
  6. { name: 'a', inject: [], immediately: false },
  7. { name: 'b', inject: [], immediately: false },
  8. ])
  9. const plugin = { apply: () => {} }
  10. describe('assertPlan', () => {
  11. it('accepts a bare roster and provided roster rows', () => {
  12. expect(() => { assertPlan({ roster }) }).not.toThrow()
  13. expect(() => { assertPlan({ roster, provide: { a: plugin, b: plugin } }) }).not.toThrow()
  14. })
  15. it('rejects provide keys outside the roster and lists the roster', () => {
  16. expect(() => { assertPlan({ roster, provide: { a: plugin, zz: plugin, yy: plugin } }) })
  17. .toThrow('provide names rows outside the roster: zz, yy; roster: a, b')
  18. })
  19. })