feat(project): init
This commit is contained in:
18
app/component/label/ffmpeg/cap.test.ts
Normal file
18
app/component/label/ffmpeg/cap.test.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { appendCapped } from "./cap"
|
||||
|
||||
describe("appendCapped", () => {
|
||||
test("keeps all items when under max", () => {
|
||||
expect(appendCapped([1, 2], [3], 10)).toEqual([1, 2, 3])
|
||||
})
|
||||
|
||||
test("drops from head when exceeding max", () => {
|
||||
expect(appendCapped([1, 2], [3, 4, 5], 3)).toEqual([3, 4, 5])
|
||||
})
|
||||
|
||||
test("calls onDrop for dropped items", () => {
|
||||
const dropped: number[] = []
|
||||
const result = appendCapped([1, 2], [3, 4, 5], 3, (x) => dropped.push(x))
|
||||
expect(result).toEqual([3, 4, 5])
|
||||
expect(dropped).toEqual([1, 2])
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user