The Coline App SDK: apps, tools, file types and surfaces that run inside Coline workspaces, and public websites with Coline Sites. TypeScript, with an in-memory test workspace. MIT.
| 5 | it("keeps numeric values together and defines a transitive mixed-field order", () => { |
| 6 | const values = ["2", 10, null, false, -2, "A", 0.5, "a", 2, undefined]; |
| 7 | // Array.sort moves undefined entries itself; collection records wrap the values. |
| 8 | const rows = values.map((value) => ({ value })); |
| 9 | const sorted = rows |
| 10 | .sort((a, b) => compareRecordValues(a.value, b.value)) |
| 11 | .map((row) => row.value); |
| 12 | expect(sorted).toEqual([-2, 0.5, 2, 10, null, undefined, "2", "A", "a", false]); |
| 13 | expect(compareRecordValues(null, "")).toBe(0); |
| 14 | expect(compareRecordValues(undefined, "")).toBe(0); |
| 15 | expect(compareRecordValues(2, 10)).toBeLessThan(0); |
| 16 | }); |
| 17 | }); |
| 18 |