Add test suite (63 tests) and CI workflow, fix Settings API bugs
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
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>
This commit is contained in:
48
src/lib/stores/config.test.ts
Normal file
48
src/lib/stores/config.test.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
import { describe, it, expect, vi } from "vitest";
|
||||
|
||||
// Mock fetch so the backend store module doesn't make real requests
|
||||
vi.stubGlobal(
|
||||
"fetch",
|
||||
vi.fn(() =>
|
||||
Promise.resolve({
|
||||
ok: true,
|
||||
json: () => Promise.resolve({}),
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
// Mock WebSocket for the backend store dependency
|
||||
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);
|
||||
|
||||
import { configStore } from "./config.svelte.ts";
|
||||
|
||||
describe("config store", () => {
|
||||
it("test_has_fetchConfig_method", () => {
|
||||
expect(typeof configStore.fetchConfig).toBe("function");
|
||||
});
|
||||
|
||||
it("test_has_updateConfig_method", () => {
|
||||
expect(typeof configStore.updateConfig).toBe("function");
|
||||
});
|
||||
|
||||
it("test_config_defaults_have_expected_keys", () => {
|
||||
const cfg = configStore.config;
|
||||
expect(cfg).toHaveProperty("user");
|
||||
expect(cfg).toHaveProperty("audio");
|
||||
expect(cfg).toHaveProperty("transcription");
|
||||
expect(cfg).toHaveProperty("display");
|
||||
expect(cfg).toHaveProperty("remote");
|
||||
expect(cfg).toHaveProperty("updates");
|
||||
});
|
||||
|
||||
it("test_remote_config_has_byok_api_key", () => {
|
||||
expect(configStore.config.remote.byok_api_key).toBeDefined();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user