Files
radicle-explorer/httpd-client/tests/project.test.ts
T
2023-05-12 14:23:10 +02:00

81 lines
2.2 KiB
TypeScript

import { describe, test } from "vitest";
import { HttpdClient } from "../index";
import { aliceMainHead, aliceRemote, rid } from "@tests/support/fixtures";
const api = new HttpdClient({
hostname: "127.0.0.1",
port: 8080,
scheme: "http",
});
describe("project", () => {
test("#getByDelegate(delegateId)", async () => {
await api.project.getByDelegate(aliceRemote);
});
test("#getAll()", async () => {
await api.project.getAll();
});
test("#getById(id)", async () => {
await api.project.getById(rid);
});
test("#getActivity(id)", async () => {
await api.project.getActivity(rid);
});
test("#getReadme(id, sha)", async () => {
await api.project.getReadme(rid, aliceMainHead);
});
test("#getBlob(id, sha, path)", async () => {
await api.project.getBlob(rid, aliceMainHead, "src/true.c");
});
test("#getTree(id, sha)", async () => {
await api.project.getTree(rid, aliceMainHead);
});
test("#getTree(id, sha, path)", async () => {
await api.project.getTree(rid, aliceMainHead, "src");
});
test("#getAllRemotes(id)", async () => {
await api.project.getAllRemotes(rid);
});
test("#getRemoteByPeer(id, peer)", async () => {
await api.project.getRemoteByPeer(rid, aliceRemote.substring(8));
});
test("#getAllCommits(id)", async () => {
await api.project.getAllCommits(rid);
});
// TODO: test since/until properly.
test("#getAllCommits(id, {parent, since, until, page, perPage})", async () => {
await api.project.getAllCommits(rid, {
parent: aliceMainHead,
since: 1679065819581,
until: 1679065819590,
page: 1,
perPage: 2,
});
});
test("#getCommitBySha(id, sha)", async () => {
await api.project.getCommitBySha(rid, aliceMainHead);
});
test.todo("#getDiff(id, revisionBase, revisionOid)");
test.todo("#getIssueById(id, issueId)");
test.todo("#getAllIssues(id)");
test.todo("#createIssue(id, { title, description, assignees, tags })");
test.todo("#updateIssue(id, issueId, issueUpdateAction, authToken)");
test.todo("#getPatchById(id, patchId)");
test.todo("#getAllPatches(id)");
test.todo("#updatePatch(id, patchId, patchUpdateAction, authToken)");
});