|
| 1 | +import { describe, expect, it } from 'vitest'; |
| 2 | +import { filterByDensity } from '../density-filter'; |
| 3 | + |
| 4 | +describe('filterByDensity', () => { |
| 5 | + const marks = ['a', 'b', 'c', 'd']; |
| 6 | + |
| 7 | + it("returns [] for 'none'", () => { |
| 8 | + expect(filterByDensity(marks, 'none')).toEqual([]); |
| 9 | + }); |
| 10 | + |
| 11 | + it("returns first + last for 'endpoints'", () => { |
| 12 | + expect(filterByDensity(marks, 'endpoints')).toEqual(['a', 'd']); |
| 13 | + }); |
| 14 | + |
| 15 | + it("returns marks unchanged for 'all'", () => { |
| 16 | + expect(filterByDensity(marks, 'all')).toBe(marks); |
| 17 | + }); |
| 18 | + |
| 19 | + it("returns marks unchanged for 'auto'", () => { |
| 20 | + expect(filterByDensity(marks, 'auto')).toBe(marks); |
| 21 | + }); |
| 22 | + |
| 23 | + it("returns single-element array unchanged for 'endpoints'", () => { |
| 24 | + const single = ['only']; |
| 25 | + expect(filterByDensity(single, 'endpoints')).toBe(single); |
| 26 | + }); |
| 27 | + |
| 28 | + it("returns empty array unchanged for 'endpoints'", () => { |
| 29 | + const empty: string[] = []; |
| 30 | + expect(filterByDensity(empty, 'endpoints')).toBe(empty); |
| 31 | + }); |
| 32 | +}); |
0 commit comments