mirror of
https://github.com/Kir-Antipov/mc-publish.git
synced 2024-11-25 18:01:07 -05:00
bf3f3c7c01
* temp Modrinth Dependencies * Fix final issues * Got to love git sometimes * Made test case for modrinth-utils * That's why testing is important kids * Included dependencies are still dependencies * Naming * Moved to Modrinth API v2 Co-authored-by: Kir_Antipov <kp.antipov@gmail.com>
37 lines
1.1 KiB
TypeScript
37 lines
1.1 KiB
TypeScript
import { jest, describe, test, expect } from "@jest/globals";
|
|
import { getProject } from "../src/utils/modrinth-utils";
|
|
|
|
describe("getProject", () => {
|
|
test("returned versions have expected ids", async () => {
|
|
jest.setTimeout(15000);
|
|
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);
|
|
}
|
|
});
|
|
|
|
test("the method returns null if project with the given slug does not exist", async () => {
|
|
jest.setTimeout(15000);
|
|
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();
|
|
}
|
|
});
|
|
});
|