Add token test.

This commit is contained in:
Nick Cipollo
2019-08-26 12:15:12 -04:00
parent 0412ec85b5
commit 488aa36d03
4 changed files with 58 additions and 4 deletions

23
__tests__/Inputs.test.ts Normal file
View File

@@ -0,0 +1,23 @@
const mockGetInput = jest.fn();
import { Inputs } from "../src/Inputs";
import { Context } from "@actions/github/lib/context";
jest.mock('@actions/core', () => {
return {getInput: mockGetInput};
});
describe('Inputs', () => {
let context: Context
let inputs: Inputs
beforeEach(() => {
context = new Context()
inputs = new Inputs(context)
mockGetInput.mockReturnValue("")
})
it('returns token', () => {
mockGetInput.mockReturnValue("42")
expect(inputs.token).toBe("42")
})
})