mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-04-19 05:30:44 -05:00
29 lines
738 B
TypeScript
29 lines
738 B
TypeScript
import { suite } from "uvu";
|
|
import * as assert from "uvu/assert";
|
|
import { lastCompletedVoting } from "./voting-time";
|
|
|
|
const LastCompletedVoting = suite("lastCompletedVoting()");
|
|
|
|
LastCompletedVoting("Previous month if voting yet to happen", () => {
|
|
assert.equal(lastCompletedVoting(new Date(Date.UTC(2022, 4, 1))), {
|
|
month: 3,
|
|
year: 2022,
|
|
});
|
|
});
|
|
|
|
LastCompletedVoting("Previous month if voting in progress", () => {
|
|
assert.equal(lastCompletedVoting(new Date(Date.UTC(2022, 4, 7))), {
|
|
month: 3,
|
|
year: 2022,
|
|
});
|
|
});
|
|
|
|
LastCompletedVoting("Same month if voting over", () => {
|
|
assert.equal(lastCompletedVoting(new Date(Date.UTC(2022, 4, 15))), {
|
|
month: 4,
|
|
year: 2022,
|
|
});
|
|
});
|
|
|
|
LastCompletedVoting.run();
|