From 814998dae0915eaf4faec992291eb956ad37d902 Mon Sep 17 00:00:00 2001 From: Joel Male Date: Thu, 10 Nov 2022 23:15:52 +1000 Subject: [PATCH] feature: additional tests --- __tests__/main.test.ts | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/__tests__/main.test.ts b/__tests__/main.test.ts index 093274d9..6cbbc2cf 100644 --- a/__tests__/main.test.ts +++ b/__tests__/main.test.ts @@ -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) }) \ No newline at end of file