From 5955cc392426300b07c9cbfdb80371a14de6b729 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 20 Apr 2020 18:20:24 +0200 Subject: scansion: Mock time libraries during tests The passage of time does not need test coverage, just look in a mirror. --- spec/scansion/prosody.cfg.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'spec/scansion/prosody.cfg.lua') diff --git a/spec/scansion/prosody.cfg.lua b/spec/scansion/prosody.cfg.lua index d7444e7a..88a5e0c9 100644 --- a/spec/scansion/prosody.cfg.lua +++ b/spec/scansion/prosody.cfg.lua @@ -1,5 +1,16 @@ --luacheck: ignore +-- Mock time functions to simplify tests +function _G.os.time() + return 1219439344; +end +package.preload["util.time"] = function () + return { + now = function () return 1219439344.1; end; + monotonic = function () return 0.1; end; + } +end + admins = { "admin@localhost" } use_libevent = true -- cgit v1.2.3