From 82e739d823e9dbe834203531cd794288c5a724c4 Mon Sep 17 00:00:00 2001 From: Smirnov Oleksandr Date: Wed, 5 Jul 2023 13:55:28 +0300 Subject: [PATCH] test(_utils): test .sreq method --- spec/unit/utils_spec.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/spec/unit/utils_spec.lua b/spec/unit/utils_spec.lua index 97f4a24..ba4119e 100644 --- a/spec/unit/utils_spec.lua +++ b/spec/unit/utils_spec.lua @@ -12,4 +12,18 @@ describe("gopher._utils", function() assert.are.same(res, true) end) end) + + describe(".sreq()", function() + local sreq = require("gopher._utils").sreq + + it("return module if it exists", function() + assert.are.same(sreq "gopher", require "gopher") + end) + + it("throw error if it doesn't exist", function() + assert.has.errors(function() + sreq "no_existing_module" + end) + end) + end) end)