Includes current frontend and backend work in progress and removes generated artifacts from tracking to keep the repository clean for дальнейшая разработка. Co-authored-by: Cursor <[email protected]>
18 lines
830 B
TypeScript
18 lines
830 B
TypeScript
import assert from "node:assert/strict"
|
|
import { groupShouldFire } from "./groups.js"
|
|
import { cooldownToMs, isCooldownElapsed } from "./cooldown.js"
|
|
|
|
assert.equal(groupShouldFire("any", []), false)
|
|
assert.equal(groupShouldFire("any", [false, false]), false)
|
|
assert.equal(groupShouldFire("any", [false, true]), true)
|
|
assert.equal(groupShouldFire("all", [true, true]), true)
|
|
assert.equal(groupShouldFire("all", [true, false]), false)
|
|
assert.equal(groupShouldFire("all", [false, false]), false)
|
|
|
|
assert.equal(cooldownToMs("1м"), 60_000)
|
|
assert.equal(isCooldownElapsed(null, "5м"), true)
|
|
assert.equal(isCooldownElapsed(new Date(Date.now() - 6 * 60_000).toISOString(), "5м"), true)
|
|
assert.equal(isCooldownElapsed(new Date(Date.now() - 2 * 60_000).toISOString(), "5м"), false)
|
|
|
|
console.log("alert-engine groups/cooldown tests ok")
|