import fc from 'fast-check'; import { describe, expect, it } from 'vitest'; import packages from '../content/packages'; import { anyPackage } from '../test/arbitraries'; import { OTHER_SHOOT, shootOptions } from './shootOptions'; import { visiblePackages } from './visiblePackages'; describe('shootOptions', () => { it('lists the live packages, then Overig', () => { expect(shootOptions(packages)).toEqual([ { value: 'Zwangerschap', label: 'Zwangerschap' }, { value: 'Newborn', label: 'Newborn' }, { value: 'Gezin', label: 'Gezin' }, { value: 'Overig', label: 'Overig' }, ]); }); it('is the shown packages in order followed by Overig (invariant)', () => { fc.assert( fc.property(fc.array(anyPackage), (input) => { const options = shootOptions(input); expect(options.at(-1)).toEqual(OTHER_SHOOT); expect(options.slice(0, -1)).toEqual( visiblePackages(input).map((pkg) => ({ value: pkg.name, label: pkg.name, })), ); }), ); }); });