Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion core/test/version_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,20 @@ import {version} from '@google/adk';
import {readFileSync} from 'node:fs';
import {describe, expect, it} from 'vitest';

/** major.minor.patch, with an optional pre-release suffix. */
const SEMVER_PATTERN = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;

describe('version', () => {
it('matches the version declared in package.json', () => {
const pkg: {version: string} = JSON.parse(
const pkg: {name: string; version: string} = JSON.parse(
readFileSync(new URL('../package.json', import.meta.url), 'utf-8'),
);

// release-please holds every workspace at the same version, so a read that
// resolved to the wrong manifest would still compare equal. Pin the name.
expect(pkg.name).toBe('@google/adk');
// Guards against both sides being undefined, which would compare equal.
expect(version).toMatch(SEMVER_PATTERN);
expect(version).toBe(pkg.version);
});
});
11 changes: 10 additions & 1 deletion dev/test/version_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,20 @@ import {describe, expect, it} from 'vitest';

import {version} from '../src/version.js';

/** major.minor.patch, with an optional pre-release suffix. */
const SEMVER_PATTERN = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;

describe('version', () => {
it('matches the version declared in package.json', () => {
const pkg: {version: string} = JSON.parse(
const pkg: {name: string; version: string} = JSON.parse(
readFileSync(new URL('../package.json', import.meta.url), 'utf-8'),
);

// release-please holds every workspace at the same version, so a read that
// resolved to the wrong manifest would still compare equal. Pin the name.
expect(pkg.name).toBe('@google/adk-devtools');
// Guards against both sides being undefined, which would compare equal.
expect(version).toMatch(SEMVER_PATTERN);
expect(version).toBe(pkg.version);
});
});
Loading