import { describe, expect, test } from 'bun:test'; import { radicaleInstalled } from './caldav-bootstrap'; // What this guard exists for: calendar and contacts moved from an app-store entry to CORE on // 2026-08-19. A fresh install gets `radicale` from machine-setup and `officer-caldav` from // CORE_PROCESSES. An existing one gets NEITHER from `git pull`, because a pull changes nothing outside // the repository — so /calendar would mount, render, and talk to nothing. // // The install side is deliberately not tested here: it shells out to a package manager, and a test that // really ran `apt-get install` would be a test that modifies the machine running it. What IS worth // pinning is that the detector asks the same question the sidecar will ask. describe('radicale detection', () => { test('answers the same question the sidecar asks — is `radicale` on PATH', () => { // `radicale.ts` spawns the bare name `radicale`, so PATH lookup is the whole contract. Asserting the // boolean matches Bun.which rather than asserting a fixed value, because this machine may or may not // have it and a test that only passes on one of those is worse than no test. expect(radicaleInstalled()).toBe(Bun.which('radicale') !== null); }); test('is a boolean, never a throw — it runs on the boot path', () => { expect(typeof radicaleInstalled()).toBe('boolean'); }); });