mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-06-02 12:08:37 +01:00
20 lines
687 B
TypeScript
20 lines
687 B
TypeScript
import { describe, expect, test } from "bun:test";
|
|
import { findNextEpisode } from "./episodes";
|
|
|
|
const ep = (id: string) => ({ Id: id });
|
|
|
|
describe("findNextEpisode", () => {
|
|
test("returns the episode after the current one", () => {
|
|
expect(findNextEpisode([ep("a"), ep("b"), ep("c")], "b")).toEqual(ep("c"));
|
|
});
|
|
test("returns null on the last episode", () => {
|
|
expect(findNextEpisode([ep("a"), ep("b")], "b")).toBeNull();
|
|
});
|
|
test("returns null when the current id is not found", () => {
|
|
expect(findNextEpisode([ep("a"), ep("b")], "x")).toBeNull();
|
|
});
|
|
test("returns null for an empty list", () => {
|
|
expect(findNextEpisode([], "a")).toBeNull();
|
|
});
|
|
});
|