5
0
Fork 0
mirror of https://github.com/hashicorp/vault-action.git synced 2025-11-10 16:46:56 +00:00
This commit is contained in:
Kevin Schoonover 2023-11-05 13:17:18 -08:00
parent e683ccdad0
commit 6ea4df8727
2 changed files with 251 additions and 328 deletions

523
dist/index.js vendored

File diff suppressed because one or more lines are too long

View file

@ -1,38 +0,0 @@
jest.mock('got');
jest.mock('@actions/core');
const core = require('@actions/core');
const got = require('got');
const { when } = require('jest-when');
const {
revokeClientToken
} = require('./revoke');
function mockApiResponse() {
const response = ""
got.post = jest.fn()
got.post.mockReturnValue(response)
}
function mockApiFailure() {
const response = { "errors": ["permission denied"] }
got.post = jest.fn()
got.post.mockReturnValue(response)
}
describe("test revoke for token", () => {
beforeEach(() => {
jest.resetAllMocks();
});
it("test revoke with success", async () => {
mockApiResponse()
await revokeClientToken(got)
console.log(got.post.mock.calls[0][1])
})
it("test revoke with error", async () => {
mockApiFailure()
await revokeClientToken(got)
console.log(got.post.mock.calls[0][1])
})
})