Some checks failed
Release / Bump version and tag (push) Successful in 4s
Sidecar Release / Bump sidecar version and tag (push) Failing after 3s
Tests / Python Backend Tests (push) Failing after 3s
Tests / Frontend Tests (push) Successful in 8s
Tests / Rust Sidecar Tests (push) Successful in 3m10s
Test suite covering all three layers: Python backend (25 tests): - AppController: state machine, start/stop, callbacks, settings reload - API server: REST endpoints, config CRUD, status, devices - Config: dot-notation get/set, persistence, nested paths - Main headless: ready event port format validation Svelte frontend (14 tests via Vitest): - Backend store: exported properties/methods, port derivation, URLs - Config store: method names (fetchConfig not loadConfig), defaults - Transcriptions store: add/clear/plaintext - File extension regression: ensures $state runes only in .svelte.ts Rust sidecar (24 tests via cargo test): - Platform/arch detection, asset name construction - Ready event deserialization (with extra fields tolerance) - Path construction, version read/write, old version cleanup - Zip extraction, SidecarManager lifecycle CI workflow (.gitea/workflows/test.yml): - Runs on push to main and PRs - Three parallel jobs: Python, Frontend, Rust Also fixes three bugs found during test planning: - Settings: /api/check-updates -> GET /api/check-update - Settings: /api/remote/login -> /api/login - Settings: /api/remote/register -> /api/register Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
72 lines
2.0 KiB
TypeScript
72 lines
2.0 KiB
TypeScript
import { describe, it, expect, vi, beforeEach } from "vitest";
|
|
|
|
// Mock WebSocket for the backend store dependency (loaded transitively)
|
|
class MockWebSocket {
|
|
onopen: ((ev: Event) => void) | null = null;
|
|
onclose: ((ev: CloseEvent) => void) | null = null;
|
|
onmessage: ((ev: MessageEvent) => void) | null = null;
|
|
onerror: ((ev: Event) => void) | null = null;
|
|
close = vi.fn();
|
|
}
|
|
vi.stubGlobal("WebSocket", MockWebSocket);
|
|
|
|
vi.stubGlobal(
|
|
"fetch",
|
|
vi.fn(() =>
|
|
Promise.resolve({
|
|
ok: true,
|
|
json: () => Promise.resolve({}),
|
|
})
|
|
)
|
|
);
|
|
|
|
import { transcriptionStore } from "./transcriptions.svelte.ts";
|
|
|
|
describe("transcriptions store", () => {
|
|
beforeEach(() => {
|
|
transcriptionStore.clearAll();
|
|
});
|
|
|
|
it("test_addTranscription", () => {
|
|
transcriptionStore.addTranscription({
|
|
text: "Hello world",
|
|
user_name: "TestUser",
|
|
timestamp: "12:00:00",
|
|
});
|
|
|
|
expect(transcriptionStore.items.length).toBe(1);
|
|
expect(transcriptionStore.items[0].text).toBe("Hello world");
|
|
expect(transcriptionStore.items[0].userName).toBe("TestUser");
|
|
expect(transcriptionStore.items[0].timestamp).toBe("12:00:00");
|
|
expect(transcriptionStore.items[0].isPreview).toBe(false);
|
|
});
|
|
|
|
it("test_clearAll", () => {
|
|
transcriptionStore.addTranscription({ text: "One" });
|
|
transcriptionStore.addTranscription({ text: "Two" });
|
|
expect(transcriptionStore.items.length).toBe(2);
|
|
|
|
transcriptionStore.clearAll();
|
|
expect(transcriptionStore.items.length).toBe(0);
|
|
});
|
|
|
|
it("test_getPlainText", () => {
|
|
transcriptionStore.addTranscription({
|
|
text: "Hello",
|
|
user_name: "Alice",
|
|
timestamp: "10:00",
|
|
});
|
|
transcriptionStore.addTranscription({
|
|
text: "World",
|
|
user_name: "Bob",
|
|
timestamp: "10:01",
|
|
});
|
|
|
|
const text = transcriptionStore.getPlainText();
|
|
expect(text).toContain("[10:00] Alice: Hello");
|
|
expect(text).toContain("[10:01] Bob: World");
|
|
// Lines separated by newline
|
|
expect(text.split("\n").length).toBe(2);
|
|
});
|
|
});
|