The Tauri shell's bundled npm environment and its first-launch flag, the server installer's --data-dir default and the NSIS installer config fell back to ~/.waggle. Use ~/.waggle-community (ADR-0011). The Rust shell keeps the name in DEFAULT_DATA_DIR_NAME in lib.rs and the launcher, which uses only Node built-ins, in DATA_DIR_NAME. packages/shared/tests/data-dir.test.ts fails when either copy, or the marketplace's, differs from @waggle/shared.
25 lines
1.2 KiB
TypeScript
25 lines
1.2 KiB
TypeScript
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}";`);
|
|
});
|
|
});
|