mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-16 11:50:42 +08:00
Remove tests relying on rad-web
This commit is contained in:
@@ -1,30 +0,0 @@
|
||||
import type { HttpdClient } from "@http-client";
|
||||
import type { RadiclePeer } from "@tests/support/peerManager.js";
|
||||
|
||||
import assert from "node:assert";
|
||||
|
||||
export async function authenticate(
|
||||
api: HttpdClient,
|
||||
peer: RadiclePeer,
|
||||
): Promise<string> {
|
||||
const { stdout } = await peer.spawn("rad-web", [
|
||||
"http://localhost:3001",
|
||||
"--no-open",
|
||||
"--connect",
|
||||
`${peer.httpdBaseUrl.hostname}:${peer.httpdBaseUrl.port}`,
|
||||
]);
|
||||
const match = stdout.match(/Visit (http:\/\/\S+) to connect/);
|
||||
assert(
|
||||
match !== null && match[1],
|
||||
`Failed to get authentication URL from: ${stdout}`,
|
||||
);
|
||||
|
||||
const authUrl = new URL(match[1]);
|
||||
const sessionId = authUrl.pathname.split("/")[2];
|
||||
|
||||
await api.session.update(sessionId, {
|
||||
sig: authUrl.searchParams.get("sig")!,
|
||||
pk: authUrl.searchParams.get("pk")!,
|
||||
});
|
||||
return sessionId;
|
||||
}
|
||||
@@ -5,37 +5,6 @@ import isMatch from "lodash/isMatch";
|
||||
|
||||
import { cobRid } from "@tests/support/fixtures";
|
||||
|
||||
export async function createIssueToBeModified(
|
||||
api: HttpdClient,
|
||||
sessionId: string,
|
||||
) {
|
||||
const { id } = await api.project.createIssue(
|
||||
cobRid,
|
||||
{ title: "aaa", description: "bbb", embeds: [], assignees: [], labels: [] },
|
||||
sessionId,
|
||||
);
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
export async function createPatchToBeModified(
|
||||
api: HttpdClient,
|
||||
sessionId: string,
|
||||
) {
|
||||
const { id } = await api.project.createPatch(
|
||||
cobRid,
|
||||
{
|
||||
title: "rrr",
|
||||
description: "ttt",
|
||||
target: "d7dd8cecae16b1108234e09dbdb5d64ae394bc25",
|
||||
oid: "38c225e2a0b47ba59def211f4e4825c31d9463ec",
|
||||
labels: [],
|
||||
},
|
||||
sessionId,
|
||||
);
|
||||
|
||||
return id;
|
||||
}
|
||||
export async function assertIssue(
|
||||
oid: string,
|
||||
change: Record<string, unknown>,
|
||||
|
||||
Reference in New Issue
Block a user