From 744b73db3dd3390dc298193b1252f83f35be4a47 Mon Sep 17 00:00:00 2001 From: Filip Tibell Date: Fri, 17 Feb 2023 15:09:30 +0100 Subject: [PATCH] Improve net tests --- tests/net/request/util.luau | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/net/request/util.luau b/tests/net/request/util.luau index e099d93..562b650 100644 --- a/tests/net/request/util.luau +++ b/tests/net/request/util.luau @@ -1,19 +1,23 @@ local util = {} -function util.pass(method, url, message: string) +function util.pass(method, url, message) local response = net.request({ method = method, url = url, }) - assert(response.ok, message) + if not response.ok then + error(string.format("%s failed!\nResponse: %s", message, stdio.format(response))) + end end -function util.fail(method, url, message: string) +function util.fail(method, url, message) local response = net.request({ method = method, url = url, }) - assert(not response.ok, message) + if not response.ok then + error(string.format("%s passed!\nResponse: %s", message, stdio.format(response))) + end end return util