2022-06-06 11:17:42 -04:00
|
|
|
import { describe, test, expect } from "@jest/globals";
|
2022-06-05 10:28:41 -04:00
|
|
|
import { getProject } from "../src/utils/modrinth-utils";
|
|
|
|
|
|
|
|
describe("getProject", () => {
|
|
|
|
test("returned versions have expected ids", async () => {
|
|
|
|
const projects = {
|
|
|
|
"sodium": "AANobbMI",
|
|
|
|
"fabric-api": "P7dR8mSH",
|
|
|
|
"sync-fabric": "OrJTMhHF",
|
|
|
|
"nether-chest": "okOUGirG",
|
|
|
|
"ebe": "OVuFYfre",
|
|
|
|
};
|
|
|
|
|
|
|
|
for (const [slug, id] of Object.entries(projects)) {
|
|
|
|
const project = await getProject(slug);
|
|
|
|
expect(project).toHaveProperty("id", id);
|
|
|
|
}
|
2022-06-06 11:17:42 -04:00
|
|
|
}, 15000);
|
2022-06-05 10:28:41 -04:00
|
|
|
|
|
|
|
test("the method returns null if project with the given slug does not exist", async () => {
|
|
|
|
const nonExistentProjects = [
|
|
|
|
"Na-11",
|
|
|
|
"api-fabric",
|
|
|
|
"sync-forge",
|
|
|
|
"ever-chest",
|
|
|
|
"beb",
|
|
|
|
"i-swear-to-god-if-someone-registers-these-mods"
|
|
|
|
];
|
|
|
|
|
|
|
|
for (const slug of nonExistentProjects) {
|
|
|
|
const project = await getProject(slug);
|
|
|
|
expect(project).toBeNull();
|
|
|
|
}
|
2022-06-06 11:17:42 -04:00
|
|
|
}, 15000);
|
2022-06-05 10:28:41 -04:00
|
|
|
});
|