mc-publish/tests/unit/platforms/curseforge/curseforge-project.spec.ts

32 lines
1.1 KiB
TypeScript
Raw Normal View History

2024-01-07 09:39:32 -05:00
import { isCurseForgeProjectId } from "@/platforms/curseforge/curseforge-project";
describe("isCurseForgeProjectId", () => {
test("returns true when input is a number", () => {
expect(isCurseForgeProjectId(123456)).toBe(true);
});
test("returns true when input is a string containing an integer", () => {
expect(isCurseForgeProjectId("123456")).toBe(true);
});
test("returns false when input is a string containing non-integer characters", () => {
expect(isCurseForgeProjectId("123abc")).toBe(false);
});
test("returns false when input is a string containing floating point number", () => {
expect(isCurseForgeProjectId("123.456")).toBe(false);
});
test("returns false when input is an empty string", () => {
expect(isCurseForgeProjectId("")).toBe(false);
});
test("returns false when input is null", () => {
expect(isCurseForgeProjectId(null)).toBe(false);
});
test("returns false when input is undefined", () => {
expect(isCurseForgeProjectId(undefined)).toBe(false);
});
});