mirror of
https://github.com/jakejarvis/sofa.git
synced 2026-08-29 01:35:39 -04:00
- 211 tests across 15 files covering services (tracking, discovery, metadata, backup, credits, webhooks, settings, update-check, colors, person), utilities (config, cron, providers, title-theme), and TMDB image URL helpers - `lib/test-preload.ts` + `bunfig.toml` wire up a global in-memory SQLite DB with migrations for all DB-backed tests - `lib/test-utils.ts` provides `clearAllTables()` and seed helpers (insertUser, insertTitle, insertTvShow, insertMovieWatch, etc.) - Export `getBackupSource`, `isKnownBackup`, `isValidBackupFilename`, `buildBackupCron`, `performUpdateCheck` internals for direct testing - GitHub Actions workflow runs `bun test --coverage` on push/PR to main
45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
import { describe, expect, test } from "bun:test";
|
|
import { isNewerVersion } from "./update-check";
|
|
|
|
describe("isNewerVersion", () => {
|
|
test("newer major version", () => {
|
|
expect(isNewerVersion("2.0.0", "1.0.0")).toBe(true);
|
|
});
|
|
|
|
test("older major version", () => {
|
|
expect(isNewerVersion("1.0.0", "2.0.0")).toBe(false);
|
|
});
|
|
|
|
test("newer minor version", () => {
|
|
expect(isNewerVersion("1.2.0", "1.1.0")).toBe(true);
|
|
});
|
|
|
|
test("older minor version", () => {
|
|
expect(isNewerVersion("1.1.0", "1.2.0")).toBe(false);
|
|
});
|
|
|
|
test("newer patch version", () => {
|
|
expect(isNewerVersion("1.0.2", "1.0.1")).toBe(true);
|
|
});
|
|
|
|
test("older patch version", () => {
|
|
expect(isNewerVersion("1.0.1", "1.0.2")).toBe(false);
|
|
});
|
|
|
|
test("equal versions return false", () => {
|
|
expect(isNewerVersion("1.2.3", "1.2.3")).toBe(false);
|
|
});
|
|
|
|
test("handles 'v' prefix on latest", () => {
|
|
expect(isNewerVersion("v2.0.0", "1.0.0")).toBe(true);
|
|
});
|
|
|
|
test("handles 'v' prefix on current", () => {
|
|
expect(isNewerVersion("2.0.0", "v1.0.0")).toBe(true);
|
|
});
|
|
|
|
test("handles 'v' prefix on both", () => {
|
|
expect(isNewerVersion("v1.0.0", "v1.0.0")).toBe(false);
|
|
});
|
|
});
|