mirror of
https://github.com/hashicorp/vault-action.git
synced 2025-11-10 16:46:56 +00:00
update
This commit is contained in:
parent
e683ccdad0
commit
6ea4df8727
2 changed files with 251 additions and 328 deletions
541
dist/index.js
vendored
541
dist/index.js
vendored
File diff suppressed because one or more lines are too long
|
|
@ -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])
|
|
||||||
})
|
|
||||||
})
|
|
||||||
Loading…
Reference in a new issue