github-pages-deploy-action/__tests__/git.test.ts

40 lines
733 B
TypeScript
Raw Normal View History

2019-11-08 08:57:58 +08:00
process.env["INPUT_FOLDER"] = "build";
import { execute } from "../src/util";
import { init } from "../src/git";
import {action} from '../src/constants'
jest.mock("../src/constants", () => ({
build: 'dist',
action: {
pusher: {
name: 'montezuma',
email: 'best@cat',
},
gitHubToken: 'exists',
}
}));
jest.mock("../src/util", () => ({
execute: jest.fn()
}));
jest.mock("@actions/io", () => ({
cp: jest.fn()
}));
describe("git", () => {
describe("init", () => {
it("should execute three commands", async () => {
await init();
expect(execute).toBeCalledTimes(3);
});
it("should fail if the dpeloyment folder begins with /", async () => {
// TODO:
})
});
});