From a9ce45b0a23420d49c75147a587bf31ffb1a2b4f Mon Sep 17 00:00:00 2001 From: Amaad Martin Date: Sat, 1 Aug 2026 15:46:31 -0700 Subject: [PATCH] test(integrations): assert the exported version is well-formed semver The consistency assertion pins version.ts to the sibling manifest, but both files are rewritten from a single release-please computed value, so a malformed version propagates to both and passes unnoticed. Assert the shape independently so the exported constant is checked, not just its agreement with package.json. The prerelease branch of the pattern is deliberate: release-please's generic updater writes whatever version it computes, and an -rc bump must not make this test the next stale one. --- integrations/test/version_test.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/integrations/test/version_test.ts b/integrations/test/version_test.ts index d2db73df0..4948a8134 100644 --- a/integrations/test/version_test.ts +++ b/integrations/test/version_test.ts @@ -8,8 +8,15 @@ import {version} from '@google/adk-integrations'; import {describe, expect, it} from 'vitest'; import packageJson from '../package.json' with {type: 'json'}; +/** Semver core, with an optional prerelease suffix such as `-rc.1`. */ +const SEMVER_PATTERN = /^\d+\.\d+\.\d+(-[\w.]+)?$/; + describe('version', () => { it('should match the version declared in package.json', () => { expect(version).toBe(packageJson.version); }); + + it('should be a well-formed semantic version string', () => { + expect(version).toMatch(SEMVER_PATTERN); + }); });