Files
Flight-Ops/app/api/version/route.test.ts
T

19 lines
635 B
TypeScript

import pkg from '@/package.json';
import { describe, expect, it } from 'vitest';
import { GET } from './route';
describe('GET /api/version', () => {
it('returns 200 with the version sourced from package.json', async () => {
const res = await GET();
expect(res.status).toBe(200);
expect(res.headers.get('content-type')).toContain('application/json');
const body = (await res.json()) as { version: string };
expect(body.version).toBe(pkg.version);
});
it('returns exactly the version field', async () => {
const res = await GET();
expect(await res.json()).toEqual({ version: pkg.version });
});
});