Compare commits
1
Commits
440d7a01a9
...
v0.6.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8e98e1c37a |
@@ -32,6 +32,7 @@
|
|||||||
import { describe, it, expect, vi, beforeEach } from "vitest";
|
import { describe, it, expect, vi, beforeEach } from "vitest";
|
||||||
import { render } from "@testing-library/svelte";
|
import { render } from "@testing-library/svelte";
|
||||||
import { tick } from "svelte";
|
import { tick } from "svelte";
|
||||||
|
import { invoke } from "@tauri-apps/api/core";
|
||||||
import VideoPlayer from "./VideoPlayer.svelte";
|
import VideoPlayer from "./VideoPlayer.svelte";
|
||||||
import { SEEK_FORWARD_SECONDS } from "./tapGestures";
|
import { SEEK_FORWARD_SECONDS } from "./tapGestures";
|
||||||
|
|
||||||
@@ -128,6 +129,23 @@ function renderPlayer() {
|
|||||||
describe("VideoPlayer tap surface (real component)", () => {
|
describe("VideoPlayer tap surface (real component)", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
vi.clearAllMocks();
|
vi.clearAllMocks();
|
||||||
|
// This file deliberately does NOT mock `$lib/api/bindings` — it renders the
|
||||||
|
// real component against the real bindings, which bottom out in the globally
|
||||||
|
// mocked `invoke`. That mock resolves `undefined` for every command, so the
|
||||||
|
// commands whose results are *rendered* have to be answered here: the
|
||||||
|
// quality picker assigns the result straight to state and then does
|
||||||
|
// `streamingQualities.length` in the template, which throws (asynchronously,
|
||||||
|
// outside any test) on undefined and fails the run with an unhandled error.
|
||||||
|
vi.mocked(invoke).mockImplementation(async (cmd: string) => {
|
||||||
|
switch (cmd) {
|
||||||
|
case "player_get_streaming_qualities":
|
||||||
|
return [];
|
||||||
|
case "player_get_video_settings":
|
||||||
|
return { streamingQuality: "original" };
|
||||||
|
default:
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("a single tap on the video toggles play/pause exactly once", async () => {
|
it("a single tap on the video toggles play/pause exactly once", async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user