Skip to content
Source
Sign inSign up
TanStack/db
Open History to see the last commit

sqlite-driver-admission-laws.test.ts

37 lines783 Bytes

1import { describe, expect, it } from 'vitest'
2import { expectAdmissionHistory } from './contracts/driver-admission-laws'
3​
4describe(`driver admission history checker`, () => {
5 it.each([
6 [
7 [1, 2, 3],
8 [1, 2, 3],
9 ],
10 [[3], [3]],
11 ])(`accepts a complete admitted history %j`, (actual, expected) => {
12 expectAdmissionHistory(
13 actual.map((value) => ({ value })),
14 expected,
15 )
16 })
17​
18 it.each([
19 [
20 [1, 3, 2],
21 [1, 2, 3],
22 ],
23 [[], [3]],
24 [[1, 3], [3]],
25 [[3, 3], [3]],
26 ])(
27 `rejects an interleaved, missing, or extra write %j`,
28 (actual, expected) => {
29 expect(() =>
30 expectAdmissionHistory(
31 actual.map((value) => ({ value })),
32 expected,
33 ),
34 ).toThrow()
35 },
36 )
37})