mirror of
https://github.com/joelwmale/webhook-action.git
synced 2024-11-28 18:35:21 +01:00
feature: additional tests
This commit is contained in:
parent
9b91251907
commit
814998dae0
1 changed files with 22 additions and 1 deletions
|
@ -4,7 +4,28 @@ import {expect, test} from '@jest/globals'
|
|||
test('it makes a post request', async () => {
|
||||
const url = 'https://httpbin.org/post'
|
||||
const body = '{"hello": "world"}'
|
||||
const insecure = false
|
||||
const res = await http.make(url, body)
|
||||
expect(res.status).toBe(200)
|
||||
})
|
||||
|
||||
test('it makes a post request with insecure', async () => {
|
||||
const url = 'https://httpbin.org/post'
|
||||
const body = '{"hello": "world"}'
|
||||
const insecure = true
|
||||
const res = await http.make(url, body, null, insecure)
|
||||
expect(res.status).toBe(200)
|
||||
})
|
||||
|
||||
test('it makes a post request with headers', async () => {
|
||||
const url = 'https://httpbin.org/post'
|
||||
const body = '{"hello": "world"}'
|
||||
const headers = '{"Content-Type": "application/json"}'
|
||||
const res = await http.make(url, body, headers)
|
||||
expect(res.status).toBe(200)
|
||||
})
|
||||
|
||||
test('it doesnt require a body', async () => {
|
||||
const url = 'https://httpbin.org/post'
|
||||
const res = await http.make(url, null)
|
||||
expect(res.status).toBe(200)
|
||||
})
|
Loading…
Reference in a new issue