mirror of
https://github.com/DeterminateSystems/update-flake-lock.git
synced 2025-07-02 19:33:49 +03:00
Add JS-specific bits to Actions
This commit is contained in:
parent
539b7a6481
commit
239b4c9810
8 changed files with 1036 additions and 82 deletions
74
src/nix.test.ts
Normal file
74
src/nix.test.ts
Normal file
|
@ -0,0 +1,74 @@
|
|||
import { makeNixCommandArgs } from "./nix.js";
|
||||
import { expect, test } from "vitest";
|
||||
|
||||
type TestCase = {
|
||||
inputs: {
|
||||
nixOptions: string[];
|
||||
flakeInputs: string[];
|
||||
commitMessage: string;
|
||||
};
|
||||
expected: string[];
|
||||
};
|
||||
|
||||
test("Nix command arguments", () => {
|
||||
const testCases: TestCase[] = [
|
||||
{
|
||||
inputs: {
|
||||
nixOptions: ["--log-format", "raw"],
|
||||
flakeInputs: [],
|
||||
commitMessage: "just testing",
|
||||
},
|
||||
expected: [
|
||||
"--log-format",
|
||||
"raw",
|
||||
"flake",
|
||||
"lock",
|
||||
"--commit-lock-file",
|
||||
"--commit-lock-file-summary",
|
||||
'"just testing"',
|
||||
],
|
||||
},
|
||||
{
|
||||
inputs: {
|
||||
nixOptions: [],
|
||||
flakeInputs: ["nixpkgs", "rust-overlay"],
|
||||
commitMessage: "just testing",
|
||||
},
|
||||
expected: [
|
||||
"flake",
|
||||
"lock",
|
||||
"--update-input",
|
||||
"nixpkgs",
|
||||
"--update-input",
|
||||
"rust-overlay",
|
||||
"--commit-lock-file",
|
||||
"--commit-lock-file-summary",
|
||||
'"just testing"',
|
||||
],
|
||||
},
|
||||
{
|
||||
inputs: {
|
||||
nixOptions: ["--debug"],
|
||||
flakeInputs: [],
|
||||
commitMessage: "just testing",
|
||||
},
|
||||
expected: [
|
||||
"--debug",
|
||||
"flake",
|
||||
"lock",
|
||||
"--commit-lock-file",
|
||||
"--commit-lock-file-summary",
|
||||
'"just testing"',
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
testCases.forEach(({ inputs, expected }) => {
|
||||
const args = makeNixCommandArgs(
|
||||
inputs.nixOptions,
|
||||
inputs.flakeInputs,
|
||||
inputs.commitMessage,
|
||||
);
|
||||
expect(args).toStrictEqual(expected);
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue