Skip to content
Merged
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: 6 additions & 5 deletions tests/scripting.test.ts
Original file line number Diff line number Diff line change
@@ -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";

Expand Down Expand Up @@ -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[");
});
Expand Down
Loading