Add token test.
This commit is contained in:
23
__tests__/Inputs.test.ts
Normal file
23
__tests__/Inputs.test.ts
Normal 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")
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user