version.test.ts 565 B

12345678910111213141516171819
  1. import { describe, test, expect } from 'bun:test';
  2. import { readCliVersion } from './version.js';
  3. describe('readCliVersion', () => {
  4. test('returns a non-empty string', () => {
  5. const version = readCliVersion();
  6. expect(typeof version).toBe('string');
  7. expect(version.length).toBeGreaterThan(0);
  8. });
  9. test('matches semver format (x.y.z)', () => {
  10. const version = readCliVersion();
  11. expect(version).toMatch(/^\d+\.\d+\.\d+/);
  12. });
  13. test('is deterministic across calls', () => {
  14. expect(readCliVersion()).toBe(readCliVersion());
  15. });
  16. });