2021-03-20 12:46:23 +01:00
|
|
|
"use strict";
|
|
|
|
|
2024-10-09 00:25:41 +02:00
|
|
|
const assert = require("node:assert/strict");
|
2021-03-20 12:46:23 +01:00
|
|
|
|
2023-02-22 23:04:10 +01:00
|
|
|
const {zrequire} = require("./lib/namespace");
|
|
|
|
const {run_test} = require("./lib/test");
|
2021-03-20 12:46:23 +01:00
|
|
|
|
|
|
|
const reload_state = zrequire("reload_state");
|
|
|
|
|
2021-03-22 19:45:29 +01:00
|
|
|
function test(label, f) {
|
2021-06-16 14:38:37 +02:00
|
|
|
run_test(label, ({override}) => {
|
2021-03-22 19:45:29 +01:00
|
|
|
reload_state.clear_for_testing();
|
2021-06-16 14:38:37 +02:00
|
|
|
f({override});
|
2021-03-22 19:45:29 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
test("set_state_to_pending", () => {
|
2021-06-10 08:32:54 +02:00
|
|
|
assert.ok(!reload_state.is_pending());
|
2021-03-20 12:46:23 +01:00
|
|
|
reload_state.set_state_to_pending();
|
2021-06-10 08:32:54 +02:00
|
|
|
assert.ok(reload_state.is_pending());
|
2021-03-20 12:46:23 +01:00
|
|
|
});
|
|
|
|
|
2021-03-22 19:45:29 +01:00
|
|
|
test("set_state_to_in_progress", () => {
|
2021-06-10 08:32:54 +02:00
|
|
|
assert.ok(!reload_state.is_in_progress());
|
2021-03-20 12:46:23 +01:00
|
|
|
reload_state.set_state_to_in_progress();
|
2021-06-10 08:32:54 +02:00
|
|
|
assert.ok(reload_state.is_in_progress());
|
2021-03-20 12:46:23 +01:00
|
|
|
});
|