Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

1.2 KB
Raw Blame
import { describe, it, expect } from 'vitest';
import { readFileSync } from 'fs';
import { dirname, join } from 'path';
import { fileURLToPath } from 'url';

const root = join(dirname(fileURLToPath(import.meta.url)), '..');
const read = (p) => readFileSync(join(root, p), 'utf8');
const SCRIPTS = ['setup.sh', 'setup.ps1', 'update.sh', 'update.ps1'];

describe('slash-do install pin', () => {
  it('SLASHDO_VERSION is an exact semver', () => {
    expect(read('scripts/SLASHDO_VERSION').trim()).toMatch(/^\d+\.\d+\.\d+$/);
  });

  it.each(SCRIPTS)('%s installs the pinned version from scripts/SLASHDO_VERSION', (file) => {
    const src = read(file);
    expect(src).not.toMatch(/slash-do@latest/);
    expect(src).toMatch(/scripts[\\/]SLASHDO_VERSION/);
    expect(src).toMatch(/npx --yes "slash-do@\$\{?SlashdoVersion\}?"|npx --yes "slash-do@\$\{?SLASHDO_VERSION\}?"/i);
  });

  it('PowerShell scripts resolve scripts/SLASHDO_VERSION via $RootDir', () => {
    for (const file of ['setup.ps1', 'update.ps1']) {
      const src = read(file);
      expect(src).toMatch(/Join-Path \$RootDir ["']scripts[\\/]SLASHDO_VERSION["']/);
      expect(src).not.toMatch(/Join-Path \$PSScriptRoot ["']scripts[\\/]SLASHDO_VERSION["']/);
    }
  });
});