chore: import upstream snapshot with attribution
Enforce Pull-Request Rules / check (push) Has been cancelled

This commit is contained in:
wehub-resource-sync
2026-07-13 12:19:24 +08:00
commit dbe3ade0dc
449 changed files with 71828 additions and 0 deletions
+54
View File
@@ -0,0 +1,54 @@
global.moment = require("moment-timezone");
const defaults = require("../../../../js/defaults");
const { formatTime } = require(`../../../../${defaults.defaultModulesDir}/utils`);
describe("Default modules utils tests", () => {
describe("formatTime", () => {
const time = new Date();
beforeEach(() => {
time.setHours(13, 13);
});
it("should convert correctly according to the config", () => {
expect(
formatTime(
{
timeFormat: 24
},
time
)
).toBe("13:13");
expect(
formatTime(
{
showPeriod: true,
showPeriodUpper: true,
timeFormat: 12
},
time
)
).toBe("1:13 PM");
expect(
formatTime(
{
showPeriod: true,
showPeriodUpper: false,
timeFormat: 12
},
time
)
).toBe("1:13 pm");
expect(
formatTime(
{
showPeriod: false,
timeFormat: 12
},
time
)
).toBe("1:13");
});
});
});