mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-15 11:20:36 +08:00
Since the legacy config is being deprecated at the end of 2024, we should start moving to the eslint flat config. I avoided the tseslint config helper function so we avoid wrapping magic. This seems to have triggered more checking since any checks in svelte files have appeared and the $$Generic type that is being deprecated had to be rewritten. Also fixes some any types that weren't caught previously
60 lines
1.3 KiB
TypeScript
60 lines
1.3 KiB
TypeScript
import type { HttpdClient } from "@httpd-client";
|
|
|
|
import { expect } from "vitest";
|
|
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>,
|
|
api: HttpdClient,
|
|
) {
|
|
expect(
|
|
//@prettier-ignore looks more readable than what prettier suggests.
|
|
isMatch(await api.project.getIssueById(cobRid, oid), change),
|
|
).toBe(true);
|
|
}
|
|
|
|
export async function assertPatch(
|
|
oid: string,
|
|
change: Record<string, unknown>,
|
|
api: HttpdClient,
|
|
) {
|
|
expect(
|
|
//@prettier-ignore looks more readable than what prettier suggests.
|
|
isMatch(await api.project.getPatchById(cobRid, oid), change),
|
|
).toBe(true);
|
|
}
|