- Move the Tauri app (React frontend + Rust backend) into desktop/ via git mv — configs unchanged (relative paths: tauri.conf.json, vite.config.ts) - Root package.json becomes a private bun workspace container with orchestration scripts; desktop package renamed gridline-desktop - Scaffold www/ with Astro 7 + Tailwind v4 (hand-wired vite plugin, static output, ready for Dokploy) - Update release.yml for the new layout: projectPath: desktop, desktop/src-tauri resource paths, rust-cache workspace path - Update README + AGENTS.md structure trees and dev commands - Verified: vitest (1074), cargo test (354), desktop build, tauri dev (window launches), tauri build (dmg + app bundles), Astro build
18 lines
754 B
TypeScript
18 lines
754 B
TypeScript
import { describe, it, expect } from "vitest";
|
|
import { pruneRecent, dedupeRecent } from "./recentConnections";
|
|
import type { RecentConnection } from "./types";
|
|
|
|
const rc = (id: string, at: string): RecentConnection => ({ connection_id: id, opened_at: at });
|
|
|
|
describe("recentConnections helpers", () => {
|
|
it("pruneRecent keeps the newest N", () => {
|
|
const list = [rc("a", "1"), rc("b", "3"), rc("c", "2")];
|
|
expect(pruneRecent(list, 2)).toEqual([rc("b", "3"), rc("c", "2")]);
|
|
});
|
|
it("dedupeRecent moves the latest occurrence of an id to the front", () => {
|
|
const list = [rc("a", "1"), rc("b", "2"), rc("a", "3")];
|
|
const out = dedupeRecent(list);
|
|
expect(out[0].connection_id).toBe("a");
|
|
expect(out).toHaveLength(2);
|
|
});
|
|
}); |