|
| 1 | +import { describe, expect, test } from "bun:test"; |
| 2 | +import type { Matrix } from "../package/matrix"; |
| 3 | +import { matrixJSON } from "./matrix"; |
| 4 | + |
| 5 | +describe("matrixJSON", () => { |
| 6 | + test.each<[Matrix, ReturnType<typeof matrixJSON>]>([ |
| 7 | + ["${{ foo }}", "${{ foo }}"], |
| 8 | + [ |
| 9 | + { foo: "${{ foo }}", bar: "${{ bar }}" }, |
| 10 | + { foo: "${{ foo }}", bar: "${{ bar }}" }, |
| 11 | + ], |
| 12 | + [ |
| 13 | + { foo: [1, 2, 3], bar: [4, "5", true, false, "${{ bar }}"] }, |
| 14 | + { foo: [1, 2, 3], bar: [4, "5", true, false, "${{ bar }}"] }, |
| 15 | + ], |
| 16 | + |
| 17 | + [{ include: "${{ foo }}" }, { include: "${{ foo }}" }], |
| 18 | + [ |
| 19 | + { include: [{ foo: "${{ foo }}", bar: "${{ bar }}" }] }, |
| 20 | + { include: [{ foo: "${{ foo }}", bar: "${{ bar }}" }] }, |
| 21 | + ], |
| 22 | + [ |
| 23 | + { |
| 24 | + include: [{ foo: [1, 2, 3], bar: [4, "5", true, false, "${{ bar }}"] }], |
| 25 | + }, |
| 26 | + { |
| 27 | + include: [{ foo: [1, 2, 3], bar: [4, "5", true, false, "${{ bar }}"] }], |
| 28 | + }, |
| 29 | + ], |
| 30 | + [ |
| 31 | + { |
| 32 | + exclude: [{ foo: [1, 2, 3], bar: [4, "5", true, false, "${{ bar }}"] }], |
| 33 | + }, |
| 34 | + { |
| 35 | + exclude: [{ foo: [1, 2, 3], bar: [4, "5", true, false, "${{ bar }}"] }], |
| 36 | + }, |
| 37 | + ], |
| 38 | + ])("matrixJSON(%j) -> %j", (matrix, expected) => { |
| 39 | + expect(matrixJSON(matrix)).toEqual(expected); |
| 40 | + }); |
| 41 | +}); |
0 commit comments