Skip to content
Closed
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
26 changes: 24 additions & 2 deletions integrations/test/version_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,32 @@
*/

import {version} from '@google/adk-integrations';
import {readFileSync} from 'node:fs';
import * as path from 'node:path';
import {fileURLToPath} from 'node:url';
import {describe, expect, it} from 'vitest';

const dirname = path.dirname(fileURLToPath(import.meta.url));

/**
* release-please rewrites `integrations/package.json` and the
* `x-release-please-version` line in `integrations/src/version.ts` together but
* never touches this test, so any literal here goes stale at the next release.
* Deriving the expectation from the manifest keeps the assertion correct across
* releases and catches the two halves drifting apart. The path is resolved from
* this file's own URL because vitest runs with the repository root as the
* working directory.
*/
const manifest: {version: string} = JSON.parse(
readFileSync(path.join(dirname, '..', 'package.json'), 'utf-8'),
);

describe('version', () => {
it('should return the correct version', () => {
expect(version).toBe('1.3.0');
it('should be a semantic version string', () => {
expect(version).toMatch(/^\d+\.\d+\.\d+/);
});

it('should match the version declared in package.json', () => {
expect(version).toBe(manifest.version);
});
});
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
"docs:generate": "typedoc",
"docs:serve": "http-server api-reference/typescript",
"docs:check": "typedoc --emit none --treatWarningsAsErrors",
"test": "vitest --project unit:core --project unit:dev --project integration --project e2e",
"test:unit": "vitest --project unit:core --project unit:dev",
"test": "vitest --project unit:core --project unit:dev --project unit:integrations --project integration --project e2e",
"test:unit": "vitest --project unit:core --project unit:dev --project unit:integrations",
"test:integration": "vitest --project integration",
"test:e2e": "vitest --project e2e",
"test:cross-language": "vitest --project cross-language",
"test:coverage": "vitest run --project unit:core --project unit:dev --project integration --project e2e --coverage",
"test:coverage": "vitest run --project unit:core --project unit:dev --project unit:integrations --project integration --project e2e --coverage",
"prepare": "husky"
},
"workspaces": [
Expand Down
Loading