From 5ac832afce8f11bfb00137ee97fc19af3629458a Mon Sep 17 00:00:00 2001 From: Leo-Paul Goffic Date: Thu, 16 Jul 2026 18:31:37 +0200 Subject: [PATCH] test: fix version in scripting test --- tests/scripting.test.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/scripting.test.ts b/tests/scripting.test.ts index 7bd439a..6ec4b74 100644 --- a/tests/scripting.test.ts +++ b/tests/scripting.test.ts @@ -1,4 +1,5 @@ import { beforeAll, describe, expect, test } from "bun:test"; +import { VERSION } from "../cli/src/version.ts"; import { createTestWorkspace, type TestWorkspace } from "./helpers.ts"; import { jsonMock } from "./mock-http.ts"; @@ -111,18 +112,18 @@ describe("scriptable exit codes and JSON errors", () => { }); test.each(["update", "upgrade"])("%s checks an explicit version", async (command) => { - const result = await workspace.runCommand(`altertable ${command} 1.2.0 --check`); + const result = await workspace.runCommand(`altertable ${command} ${VERSION} --check`); expect(result.exitCode).toBe(0); - expect(result.stdout).toContain("Target version v1.2.0 is already installed."); + expect(result.stdout).toContain(`Target version v${VERSION} is already installed.`); }); test("update accepts inherited global flags after its arguments", async () => { - const json = await workspace.runCommand("altertable update 1.2.0 --check --json"); - const plain = await workspace.runCommand("altertable update 1.2.0 --check --no-color"); + const json = await workspace.runCommand(`altertable update ${VERSION} --check --json`); + const plain = await workspace.runCommand(`altertable update ${VERSION} --check --no-color`); expect(json.exitCode).toBe(0); - expect(JSON.parse(json.stdout).latest_version).toBe("1.2.0"); + expect(JSON.parse(json.stdout).latest_version).toBe(VERSION); expect(plain.exitCode).toBe(0); expect(plain.stdout).not.toContain("\u001B["); });