1
0
Fork 0
toolkit/packages/oidc-client/__tests__/main.test.ts

33 lines
965 B
TypeScript
Raw Normal View History

2021-07-20 10:26:28 +00:00
var httpclient = require('@actions/http-client')
var configvar = require('./../src/internal/config-variables')
var main = require('./../src/main')
2021-07-01 02:41:28 +00:00
2021-07-20 06:38:25 +00:00
describe('oidc-client-tests', () => {
it('Get Http Client', async () => {
2021-07-20 10:26:28 +00:00
const http = new httpclient.HttpClient('actions/oidc-client')
expect(http).toBeDefined()
})
it('HTTP get request to get token endpoint', async () => {
const http = new httpclient.HttpClient('actions/oidc-client')
const res = await http.get(
'https://ghactionsoidc.azurewebsites.net/.well-known/openid-configuration'
)
expect(res.message.statusCode).toBe(200)
2021-07-20 06:38:25 +00:00
})
2021-07-01 02:41:28 +00:00
2021-07-20 06:38:25 +00:00
it('Get token endpoint', async () => {
let url = await configvar.getIDTokenUrl()
expect(url).toBeDefined()
})
2021-07-01 02:41:28 +00:00
2021-07-20 10:26:28 +00:00
it('Fetch Id token', async () => {
var id_token = main.getIDToken('helloworld')
expect(id_token).toBeDefined()
})
2021-07-01 02:41:28 +00:00
})
2021-07-20 06:38:25 +00:00
/*test('HTTP get request to get token endpoint', async () => {
expect(1).toBe(1)
})*/