Rename input.test.ts to input.test.js

This commit is contained in:
Rin Arakaki 2023-02-13 03:27:07 +09:00 committed by GitHub
parent 54f21e34c4
commit 77c2b0924a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

33
__tests__/input.test.js Normal file
View file

@ -0,0 +1,33 @@
import * as input from "../src/input";
const testEnvVars = {
INPUT_COMMAND: "build",
// There are few unnecessary spaces here to check that args parser works properly
INPUT_ARGS:
" --release --target x86_64-unknown-linux-gnu --no-default-features --features unstable ",
"INPUT_USE-CROSS": "true",
INPUT_TOOLCHAIN: "+nightly",
};
describe("actions-rs/cargo/input", () => {
beforeEach(() => {
for (const key in testEnvVars)
process.env[key] = testEnvVars[key as keyof typeof testEnvVars];
});
it("Parses action input into cargo input", () => {
const result = input.get();
expect(result.command).toBe("build");
expect(result.args).toStrictEqual([
"--release",
"--target",
"x86_64-unknown-linux-gnu",
"--no-default-features",
"--features",
"unstable",
]);
expect(result.useCross).toBe(true);
expect(result.toolchain).toBe("nightly");
});
});