mirror of
https://github.com/hashicorp/vault-action.git
synced 2026-04-07 12:39:26 +00:00
Fix tests from jest-when version bump (#311)
* Fix tests from jest-when version bump * Delete unused test helpers * Add workflow_dispatch for tests
This commit is contained in:
parent
25737aea2b
commit
8e9712e63b
6 changed files with 40 additions and 51 deletions
|
|
@ -94,7 +94,7 @@ describe('parseSecretsInput', () => {
|
|||
describe('parseHeaders', () => {
|
||||
it('parses simple header', () => {
|
||||
when(core.getInput)
|
||||
.calledWith('extraHeaders')
|
||||
.calledWith('extraHeaders', undefined)
|
||||
.mockReturnValueOnce('TEST: 1');
|
||||
const result = parseHeadersInput('extraHeaders');
|
||||
expect(Array.from(result)).toContainEqual(['test', '1']);
|
||||
|
|
@ -102,7 +102,7 @@ describe('parseHeaders', () => {
|
|||
|
||||
it('parses simple header with whitespace', () => {
|
||||
when(core.getInput)
|
||||
.calledWith('extraHeaders')
|
||||
.calledWith('extraHeaders', undefined)
|
||||
.mockReturnValueOnce(`
|
||||
TEST: 1
|
||||
`);
|
||||
|
|
@ -112,7 +112,7 @@ describe('parseHeaders', () => {
|
|||
|
||||
it('parses multiple headers', () => {
|
||||
when(core.getInput)
|
||||
.calledWith('extraHeaders')
|
||||
.calledWith('extraHeaders', undefined)
|
||||
.mockReturnValueOnce(`
|
||||
TEST: 1
|
||||
FOO: bAr
|
||||
|
|
@ -124,7 +124,7 @@ describe('parseHeaders', () => {
|
|||
|
||||
it('parses null response', () => {
|
||||
when(core.getInput)
|
||||
.calledWith('extraHeaders')
|
||||
.calledWith('extraHeaders', undefined)
|
||||
.mockReturnValueOnce(null);
|
||||
const result = parseHeadersInput('extraHeaders');
|
||||
expect(Array.from(result)).toHaveLength(0);
|
||||
|
|
@ -136,29 +136,29 @@ describe('exportSecrets', () => {
|
|||
jest.resetAllMocks();
|
||||
|
||||
when(core.getInput)
|
||||
.calledWith('url')
|
||||
.calledWith('url', expect.anything())
|
||||
.mockReturnValueOnce('http://vault:8200');
|
||||
|
||||
when(core.getInput)
|
||||
.calledWith('token')
|
||||
.calledWith('token', expect.anything())
|
||||
.mockReturnValueOnce('EXAMPLE');
|
||||
});
|
||||
|
||||
function mockInput(key) {
|
||||
when(core.getInput)
|
||||
.calledWith('secrets')
|
||||
.calledWith('secrets', expect.anything())
|
||||
.mockReturnValueOnce(key);
|
||||
}
|
||||
|
||||
function mockVersion(version) {
|
||||
when(core.getInput)
|
||||
.calledWith('kv-version')
|
||||
.calledWith('kv-version', expect.anything())
|
||||
.mockReturnValueOnce(version);
|
||||
}
|
||||
|
||||
function mockExtraHeaders(headerString) {
|
||||
when(core.getInput)
|
||||
.calledWith('extraHeaders')
|
||||
.calledWith('extraHeaders', expect.anything())
|
||||
.mockReturnValueOnce(headerString);
|
||||
}
|
||||
|
||||
|
|
@ -181,7 +181,7 @@ describe('exportSecrets', () => {
|
|||
|
||||
function mockExportToken(doExport) {
|
||||
when(core.getInput)
|
||||
.calledWith('exportToken')
|
||||
.calledWith('exportToken', expect.anything())
|
||||
.mockReturnValueOnce(doExport);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ const {
|
|||
|
||||
function mockInput(name, key) {
|
||||
when(core.getInput)
|
||||
.calledWith(name)
|
||||
.calledWith(name, expect.anything())
|
||||
.mockReturnValueOnce(key);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue