mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-21 06:10:44 +08:00
Remove tests relying on rad-web
This commit is contained in:
@@ -4,19 +4,10 @@ import { HttpdClient } from "@http-client";
|
||||
import {
|
||||
aliceMainHead,
|
||||
aliceRemote,
|
||||
bobRemote,
|
||||
cobRid,
|
||||
defaultHttpdPort,
|
||||
sourceBrowsingRid,
|
||||
} from "@tests/support/fixtures.js";
|
||||
import {
|
||||
assertIssue,
|
||||
assertPatch,
|
||||
createIssueToBeModified,
|
||||
createPatchToBeModified,
|
||||
} from "@http-client/tests/support/support";
|
||||
import { authenticate } from "@http-client/tests/support/httpd.js";
|
||||
import { testFixture as testWithAPI } from "@http-client/tests/support/fixtures.js";
|
||||
|
||||
describe("project", () => {
|
||||
const api = new HttpdClient({
|
||||
@@ -114,114 +105,6 @@ describe("project", () => {
|
||||
});
|
||||
});
|
||||
|
||||
testWithAPI(
|
||||
"#createIssue(id, { title, description, assignees, labels })",
|
||||
async ({ httpd: { api, peer } }) => {
|
||||
const sessionId = await authenticate(api, peer);
|
||||
const { id: issueId } = await api.project.createIssue(
|
||||
cobRid,
|
||||
{
|
||||
title: "aaa",
|
||||
description: "bbb",
|
||||
assignees: [],
|
||||
embeds: [],
|
||||
labels: ["bug", "documentation"],
|
||||
},
|
||||
sessionId,
|
||||
);
|
||||
await assertIssue(
|
||||
issueId,
|
||||
{
|
||||
title: "aaa",
|
||||
discussion: [{ body: "bbb" }],
|
||||
assignees: [],
|
||||
labels: ["bug", "documentation"],
|
||||
},
|
||||
api,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
testWithAPI(
|
||||
"#updateIssue(id, issueId, { type: 'edit' }, authToken)",
|
||||
async ({ httpd: { api, peer } }) => {
|
||||
const sessionId = await authenticate(api, peer);
|
||||
const issueId = await createIssueToBeModified(api, sessionId);
|
||||
await api.project.updateIssue(
|
||||
cobRid,
|
||||
issueId,
|
||||
{ type: "edit", title: "ccc" },
|
||||
sessionId,
|
||||
);
|
||||
await assertIssue(issueId, { title: "ccc" }, api);
|
||||
},
|
||||
);
|
||||
|
||||
testWithAPI(
|
||||
"#updateIssue(id, issueId, { type: 'label' }, authToken)",
|
||||
async ({ httpd: { api, peer } }) => {
|
||||
const sessionId = await authenticate(api, peer);
|
||||
const issueId = await createIssueToBeModified(api, sessionId);
|
||||
await api.project.updateIssue(
|
||||
cobRid,
|
||||
issueId,
|
||||
{ type: "label", labels: ["bug"] },
|
||||
sessionId,
|
||||
);
|
||||
await assertIssue(issueId, { labels: ["bug"] }, api);
|
||||
},
|
||||
);
|
||||
|
||||
testWithAPI(
|
||||
"#updateIssue(id, issueId, { type: 'assign' }, authToken)",
|
||||
async ({ httpd: { api, peer } }) => {
|
||||
const sessionId = await authenticate(api, peer);
|
||||
const issueId = await createIssueToBeModified(api, sessionId);
|
||||
await api.project.updateIssue(
|
||||
cobRid,
|
||||
issueId,
|
||||
{
|
||||
type: "assign",
|
||||
assignees: [bobRemote],
|
||||
},
|
||||
sessionId,
|
||||
);
|
||||
await assertIssue(
|
||||
issueId,
|
||||
{
|
||||
assignees: [
|
||||
{
|
||||
id: "did:key:z6Mkg49NtQR2LyYRDCQFK4w1VVHqhypZSSRo7HsyuN7SV7v5",
|
||||
alias: "bob",
|
||||
},
|
||||
],
|
||||
},
|
||||
api,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
testWithAPI(
|
||||
"#updateIssue(id, issueId, { type: 'lifecycle' }, authToken)",
|
||||
async ({ httpd: { api, peer } }) => {
|
||||
const sessionId = await authenticate(api, peer);
|
||||
const issueId = await createIssueToBeModified(api, sessionId);
|
||||
await api.project.updateIssue(
|
||||
cobRid,
|
||||
issueId,
|
||||
{ type: "lifecycle", state: { status: "closed", reason: "solved" } },
|
||||
sessionId,
|
||||
);
|
||||
await assertIssue(
|
||||
issueId,
|
||||
{
|
||||
state: { status: "closed", reason: "solved" },
|
||||
},
|
||||
api,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
test("#getPatchById(id, patchId)", async () => {
|
||||
await api.project.getPatchById(
|
||||
cobRid,
|
||||
@@ -232,60 +115,4 @@ describe("project", () => {
|
||||
test("#getAllPatches(id)", async () => {
|
||||
await api.project.getAllPatches(cobRid);
|
||||
});
|
||||
|
||||
testWithAPI(
|
||||
"#createPatch(id, patchCreate, authToken)",
|
||||
async ({ httpd: { api, peer } }) => {
|
||||
const sessionId = await authenticate(api, peer);
|
||||
const { id: oid } = await api.project.createPatch(
|
||||
cobRid,
|
||||
{
|
||||
title: "ppp",
|
||||
description: "qqq",
|
||||
target: "d7dd8cecae16b1108234e09dbdb5d64ae394bc25",
|
||||
oid: "38c225e2a0b47ba59def211f4e4825c31d9463ec",
|
||||
labels: [],
|
||||
},
|
||||
sessionId,
|
||||
);
|
||||
await assertPatch(
|
||||
oid,
|
||||
{
|
||||
title: "ppp",
|
||||
state: { status: "open" },
|
||||
target: "delegates",
|
||||
labels: [],
|
||||
revisions: [
|
||||
{
|
||||
description: "qqq",
|
||||
base: "d7dd8cecae16b1108234e09dbdb5d64ae394bc25",
|
||||
oid: "38c225e2a0b47ba59def211f4e4825c31d9463ec",
|
||||
},
|
||||
],
|
||||
},
|
||||
api,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
testWithAPI(
|
||||
"#updatePatch(id, patchId, { type: 'edit' }, authToken)",
|
||||
async ({ httpd: { api, peer } }) => {
|
||||
const sessionId = await authenticate(api, peer);
|
||||
const patchId = await createPatchToBeModified(api, sessionId);
|
||||
await api.project.updatePatch(
|
||||
cobRid,
|
||||
patchId,
|
||||
{ type: "label", labels: ["bug"] },
|
||||
sessionId,
|
||||
);
|
||||
await assertPatch(
|
||||
patchId,
|
||||
{
|
||||
labels: ["bug"],
|
||||
},
|
||||
api,
|
||||
);
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user