chore(format): run prettier over src/ and scripts/
Formatting was configured but never enforced: `bun run format:check` reported 199 unformatted files and ran in no workflow and in no git hook, so .prettierrc (printWidth 100, trailing commas) described an intention rather than the tree. This is the one-time sweep that makes the check gateable. Whitespace and token-reflow only -- no behavioural change: `bun run check` reports 0 errors and all 1053 frontend tests pass before and after. Kept out of every other commit on purpose. A 199-file diff mixed with real changes is unreviewable, and the next commit turns format:check into a hard CI gate so this cannot silently accumulate again.
This commit is contained in:
@@ -30,8 +30,14 @@ import type { AdapterHost } from "./types";
|
||||
|
||||
function makeHost(): AdapterHost {
|
||||
return {
|
||||
onState: vi.fn(), onPosition: vi.fn(), onMediaLoaded: vi.fn(), onEnded: vi.fn(),
|
||||
onError: vi.fn(), onStreamUrlChanged: vi.fn(), onBuffering: vi.fn(), onReady: vi.fn(),
|
||||
onState: vi.fn(),
|
||||
onPosition: vi.fn(),
|
||||
onMediaLoaded: vi.fn(),
|
||||
onEnded: vi.fn(),
|
||||
onError: vi.fn(),
|
||||
onStreamUrlChanged: vi.fn(),
|
||||
onBuffering: vi.fn(),
|
||||
onReady: vi.fn(),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -67,9 +73,14 @@ describe("NativePlayerAdapter", () => {
|
||||
|
||||
it("load() seeds a resume position", async () => {
|
||||
await adapter.load("url", {
|
||||
mediaId: "m", mediaSourceId: null, needsTranscoding: false,
|
||||
initialPosition: 90, isLive: false, audioTrackIndex: null,
|
||||
knownDuration: 0, subtitleTracks: [],
|
||||
mediaId: "m",
|
||||
mediaSourceId: null,
|
||||
needsTranscoding: false,
|
||||
initialPosition: 90,
|
||||
isLive: false,
|
||||
audioTrackIndex: null,
|
||||
knownDuration: 0,
|
||||
subtitleTracks: [],
|
||||
});
|
||||
expect(adapter.getPosition()).toBe(90);
|
||||
});
|
||||
@@ -80,18 +91,28 @@ describe("NativePlayerAdapter", () => {
|
||||
// adapter must actually *issue* the seek.
|
||||
it("load() issues the resume seek to the backend, not just records it", async () => {
|
||||
await adapter.load("url", {
|
||||
mediaId: "m", mediaSourceId: null, needsTranscoding: false,
|
||||
initialPosition: 90, isLive: false, audioTrackIndex: null,
|
||||
knownDuration: 0, subtitleTracks: [],
|
||||
mediaId: "m",
|
||||
mediaSourceId: null,
|
||||
needsTranscoding: false,
|
||||
initialPosition: 90,
|
||||
isLive: false,
|
||||
audioTrackIndex: null,
|
||||
knownDuration: 0,
|
||||
subtitleTracks: [],
|
||||
});
|
||||
expect(playerSeek).toHaveBeenCalledWith(90);
|
||||
});
|
||||
|
||||
it("load() does not seek when starting from the beginning", async () => {
|
||||
await adapter.load("url", {
|
||||
mediaId: "m", mediaSourceId: null, needsTranscoding: false,
|
||||
initialPosition: 0, isLive: false, audioTrackIndex: null,
|
||||
knownDuration: 0, subtitleTracks: [],
|
||||
mediaId: "m",
|
||||
mediaSourceId: null,
|
||||
needsTranscoding: false,
|
||||
initialPosition: 0,
|
||||
isLive: false,
|
||||
audioTrackIndex: null,
|
||||
knownDuration: 0,
|
||||
subtitleTracks: [],
|
||||
});
|
||||
expect(playerSeek).not.toHaveBeenCalled();
|
||||
});
|
||||
@@ -100,9 +121,14 @@ describe("NativePlayerAdapter", () => {
|
||||
// no-op and at worst knocks the HLS window off its live edge.
|
||||
it("load() never seeks a live stream", async () => {
|
||||
await adapter.load("url", {
|
||||
mediaId: "m", mediaSourceId: null, needsTranscoding: false,
|
||||
initialPosition: 90, isLive: true, audioTrackIndex: null,
|
||||
knownDuration: 0, subtitleTracks: [],
|
||||
mediaId: "m",
|
||||
mediaSourceId: null,
|
||||
needsTranscoding: false,
|
||||
initialPosition: 90,
|
||||
isLive: true,
|
||||
audioTrackIndex: null,
|
||||
knownDuration: 0,
|
||||
subtitleTracks: [],
|
||||
});
|
||||
expect(playerSeek).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user