import fs from 'node:fs'; import path from 'node:path'; import { fileURLToPath } from 'node:url'; import { describe, it, expect } from 'vitest'; import { DEFAULT_DATA_DIR_LABEL, DEFAULT_DATA_DIR_NAME } from '../src/data-dir.js'; import { DATA_DIR_NAME as LAUNCHER_DATA_DIR_NAME } from '../../launcher/src/platform.js'; import { DATA_DIR_NAME as MARKETPLACE_DATA_DIR_NAME } from '../../marketplace/src/data-dir.js'; const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../..'); // ADR-0011: the community edition never defaults to the commercial ~/.waggle. describe('default data directory', () => { it('is separate from the commercial edition', () => { expect(DEFAULT_DATA_DIR_NAME).toBe('.waggle-community'); expect(DEFAULT_DATA_DIR_LABEL).toBe('~/.waggle-community'); }); it('has the same name in the launcher, the marketplace and the Rust shell', () => { expect(LAUNCHER_DATA_DIR_NAME).toBe(DEFAULT_DATA_DIR_NAME); expect(MARKETPLACE_DATA_DIR_NAME).toBe(DEFAULT_DATA_DIR_NAME); const lib = fs.readFileSync(path.join(ROOT, 'app/src-tauri/src/lib.rs'), 'utf8'); expect(lib).toContain(`const DEFAULT_DATA_DIR_NAME: &str = "${DEFAULT_DATA_DIR_NAME}";`); }); });