open-design/apps/daemon/tests/version-route.test.ts
marco 5dd70b5016
Some checks failed
ci / Validate workspace (push) Successful in 12m32s
landing-page-ci / Validate landing page (push) Successful in 9m41s
landing-page-deploy / Deploy landing page (push) Failing after 5m23s
github-metrics / Generate repository metrics SVG (push) Failing after 2m3s
refresh-contributors-wall / Refresh contributors wall cache bust (push) Failing after 11s
Initial import: open-design source for helix-mind.ai distribution
This repository contains the open-design daemon CLI source code, built
and packaged at https://helix-mind.ai/cli/open-design/latest.tgz for use
by the HelixMind /design slash command.

Licenses: Apache-2.0 (root) + MIT (skills/*)
2026-05-06 20:50:24 +02:00

49 lines
1.5 KiB
TypeScript

import type http from 'node:http';
import { afterAll, beforeAll, describe, expect, it } from 'vitest';
import { startServer } from '../src/server.js';
describe('/api/version', () => {
let server: http.Server;
let baseUrl: string;
beforeAll(async () => {
const started = await startServer({ port: 0, returnServer: true }) as {
url: string;
server: http.Server;
};
baseUrl = started.url;
server = started.server;
});
afterAll(() => new Promise<void>((resolve) => server.close(() => resolve())));
it('returns current app version info', async () => {
const res = await fetch(`${baseUrl}/api/version`);
const json = await res.json() as unknown;
expect(res.ok).toBe(true);
expect(json).toEqual({
version: {
version: expect.any(String),
channel: expect.any(String),
packaged: expect.any(Boolean),
platform: expect.any(String),
arch: expect.any(String),
},
});
});
it('keeps health version aligned with version endpoint', async () => {
const [healthRes, versionRes] = await Promise.all([
fetch(`${baseUrl}/api/health`),
fetch(`${baseUrl}/api/version`),
]);
const health = await healthRes.json() as { ok?: unknown; version?: unknown };
const version = await versionRes.json() as { version?: { version?: unknown } };
expect(healthRes.ok).toBe(true);
expect(versionRes.ok).toBe(true);
expect(health).toEqual({ ok: true, version: version.version?.version });
});
});