mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-10-08 03:10:26 +00:00
fabro(01KTAA1N20RX3J8ATGKVP3EKYQ): simplify_opus (succeeded)
Fabro-Run: 01KTAA1N20RX3J8ATGKVP3EKYQ
Fabro-Completed: 6
Fabro-Checkpoint: 5ce4f6caf2
⚒️ Generated with [Fabro](https://fabro.sh)
This commit is contained in:
parent
33b39978ce
commit
6be8f6b5d0
10 changed files with 30 additions and 80 deletions
|
|
@ -6,6 +6,7 @@ import {
|
|||
RunSummaryPanelView,
|
||||
type RunSummaryPanelViewProps,
|
||||
} from "./run-summary-panel";
|
||||
import { testPrincipal } from "../lib/test-fixtures";
|
||||
|
||||
function instanceText(instance: TestRenderer.ReactTestInstance): string {
|
||||
const parts: string[] = [];
|
||||
|
|
@ -52,15 +53,10 @@ function cellAfterLabel(
|
|||
|
||||
function makeRun(overrides: Record<string, any> = {}) {
|
||||
return {
|
||||
id: "run_1",
|
||||
created_by: {
|
||||
kind: "user",
|
||||
identity: { issuer: "fabro:test", subject: "test-user" },
|
||||
login: "test",
|
||||
auth_method: "dev_token",
|
||||
},
|
||||
diff: null,
|
||||
billing: null,
|
||||
id: "run_1",
|
||||
created_by: testPrincipal(),
|
||||
diff: null,
|
||||
billing: null,
|
||||
...overrides,
|
||||
} as any;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { describe, expect, test } from "bun:test";
|
||||
import type { Principal, Run, RunStatus as ApiRunStatus } from "@qltysh/fabro-api-client";
|
||||
import type { Run, RunStatus as ApiRunStatus } from "@qltysh/fabro-api-client";
|
||||
import {
|
||||
columnForStatus,
|
||||
columnStatusDisplay,
|
||||
|
|
@ -8,15 +8,7 @@ import {
|
|||
mapRunToRunItem,
|
||||
runStatusDisplay,
|
||||
} from "./runs";
|
||||
|
||||
function testPrincipal(): Principal {
|
||||
return {
|
||||
kind: "user",
|
||||
identity: { issuer: "fabro:test", subject: "test-user" },
|
||||
login: "test",
|
||||
auth_method: "dev_token",
|
||||
};
|
||||
}
|
||||
import { testPrincipal } from "../lib/test-fixtures";
|
||||
|
||||
function makeRun(overrides: Partial<Run> = {}): Run {
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -24,13 +24,7 @@ import {
|
|||
unarchiveRuns,
|
||||
} from "./run-actions";
|
||||
import { generatedAxios } from "./api-client";
|
||||
|
||||
const TEST_PRINCIPAL = {
|
||||
kind: "user",
|
||||
identity: { issuer: "fabro:test", subject: "test-user" },
|
||||
login: "test",
|
||||
auth_method: "dev_token",
|
||||
};
|
||||
import { testPrincipal } from "./test-fixtures";
|
||||
|
||||
type StubResponseInit = {
|
||||
status: number;
|
||||
|
|
@ -54,7 +48,7 @@ function makeRun(status: RunStatus, archived = false): Run {
|
|||
workflow: { slug: "fix_build", name: "Fix Build", graph_name: null, node_count: 0, edge_count: 0 },
|
||||
automation: null,
|
||||
repository: null,
|
||||
created_by: TEST_PRINCIPAL,
|
||||
created_by: testPrincipal(),
|
||||
origin: { kind: "api" },
|
||||
labels: {},
|
||||
lifecycle: {
|
||||
|
|
|
|||
10
apps/fabro-web/app/lib/test-fixtures.ts
Normal file
10
apps/fabro-web/app/lib/test-fixtures.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import type { Principal } from "@qltysh/fabro-api-client";
|
||||
|
||||
export function testPrincipal(): Principal {
|
||||
return {
|
||||
kind: "user",
|
||||
identity: { issuer: "fabro:test", subject: "test-user" },
|
||||
login: "test",
|
||||
auth_method: "dev_token",
|
||||
};
|
||||
}
|
||||
|
|
@ -4,6 +4,7 @@ import TestRenderer, { act } from "react-test-renderer";
|
|||
import { createMemoryRouter, RouterProvider } from "react-router";
|
||||
|
||||
import { ToastProvider } from "../components/toast";
|
||||
import { testPrincipal } from "../lib/test-fixtures";
|
||||
import { setupReactTestEnv } from "../lib/test-utils";
|
||||
|
||||
let currentRun: any = null;
|
||||
|
|
@ -101,13 +102,6 @@ mock.module("swr", () => ({
|
|||
const { default: AutomationsNew } = await import("./automations-new");
|
||||
mock.restore();
|
||||
|
||||
const TEST_PRINCIPAL = {
|
||||
kind: "user",
|
||||
identity: { issuer: "fabro:test", subject: "test-user" },
|
||||
login: "test",
|
||||
auth_method: "dev_token",
|
||||
};
|
||||
|
||||
function makeRun(overrides: Record<string, unknown> = {}) {
|
||||
return {
|
||||
id: "run_1",
|
||||
|
|
@ -127,7 +121,7 @@ function makeRun(overrides: Record<string, unknown> = {}) {
|
|||
origin_url: "https://github.com/fallback/repo.git",
|
||||
provider: "github",
|
||||
},
|
||||
created_by: TEST_PRINCIPAL,
|
||||
created_by: testPrincipal(),
|
||||
origin: { kind: "api" },
|
||||
labels: {},
|
||||
lifecycle: {
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import {
|
|||
|
||||
import { ToastProvider } from "../components/toast";
|
||||
import { DemoModeProvider } from "../lib/demo-mode";
|
||||
import { testPrincipal } from "../lib/test-fixtures";
|
||||
|
||||
let currentRunSummary: any = null;
|
||||
let currentRunState: any = null;
|
||||
|
|
@ -20,13 +21,6 @@ let currentQuestions: any[] = [];
|
|||
let deleteRunApiResult: Promise<unknown> | null = null;
|
||||
const mountedRenderers: TestRenderer.ReactTestRenderer[] = [];
|
||||
|
||||
const TEST_PRINCIPAL = {
|
||||
kind: "user",
|
||||
identity: { issuer: "fabro:test", subject: "test-user" },
|
||||
login: "test",
|
||||
auth_method: "dev_token",
|
||||
};
|
||||
|
||||
const deleteRunApiMock = mock((_id: string) =>
|
||||
deleteRunApiResult ?? Promise.resolve({}),
|
||||
);
|
||||
|
|
@ -228,7 +222,7 @@ function makeRunSummary({
|
|||
workflow: { slug: "default", name: "Default", graph_name: null, node_count: 0, edge_count: 0 },
|
||||
automation,
|
||||
repository: { name: "fabro", origin_url: null, provider: "unknown" },
|
||||
created_by: TEST_PRINCIPAL,
|
||||
created_by: testPrincipal(),
|
||||
origin: { kind: "api" },
|
||||
labels: {},
|
||||
lifecycle: {
|
||||
|
|
|
|||
|
|
@ -5,13 +5,7 @@ import { MemoryRouter, Route, Routes } from "react-router";
|
|||
import { toast as sonnerToast } from "sonner";
|
||||
|
||||
import { ToastProvider } from "../components/toast";
|
||||
|
||||
const TEST_PRINCIPAL = {
|
||||
kind: "user",
|
||||
identity: { issuer: "fabro:test", subject: "test-user" },
|
||||
login: "test",
|
||||
auth_method: "dev_token",
|
||||
};
|
||||
import { testPrincipal } from "../lib/test-fixtures";
|
||||
|
||||
let currentFilesPayload: any = null;
|
||||
let currentCommitsPayload: any = null;
|
||||
|
|
@ -58,7 +52,7 @@ mock.module("../lib/queries", () => ({
|
|||
workflow: { slug: "default", name: "Default", graph_name: null, node_count: 0, edge_count: 0 },
|
||||
automation: null,
|
||||
repository: { name: "fabro", origin_url: null, provider: "unknown" },
|
||||
created_by: TEST_PRINCIPAL,
|
||||
created_by: testPrincipal(),
|
||||
origin: { kind: "api" },
|
||||
labels: {},
|
||||
lifecycle: {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
import { afterEach, beforeEach, describe, expect, mock, test } from "bun:test";
|
||||
import TestRenderer, { act } from "react-test-renderer";
|
||||
import { createMemoryRouter, RouterProvider } from "react-router";
|
||||
import type { PaginatedRunList, Principal, Run } from "@qltysh/fabro-api-client";
|
||||
import type { PaginatedRunList, Run } from "@qltysh/fabro-api-client";
|
||||
|
||||
import { ToastProvider } from "../components/toast";
|
||||
import { CHILD_RUNS_LIST_PREFERENCES_STORAGE_KEY } from "../components/runs-list/preferences";
|
||||
import { testPrincipal } from "../lib/test-fixtures";
|
||||
import { setupReactTestEnv } from "../lib/test-utils";
|
||||
|
||||
class MemoryStorage {
|
||||
|
|
@ -27,15 +28,6 @@ let previousElement: unknown;
|
|||
let hadElement = false;
|
||||
const mountedRenderers: TestRenderer.ReactTestRenderer[] = [];
|
||||
|
||||
function testPrincipal(): Principal {
|
||||
return {
|
||||
kind: "user",
|
||||
identity: { issuer: "fabro:test", subject: "test-user" },
|
||||
login: "test",
|
||||
auth_method: "dev_token",
|
||||
};
|
||||
}
|
||||
|
||||
function run(id: string, repo = "qlty/fabro", workflow = "release"): Run {
|
||||
return {
|
||||
id,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { describe, expect, test } from "bun:test";
|
||||
import type { BoardColumn, Principal, Run } from "@qltysh/fabro-api-client";
|
||||
import type { BoardColumn, Run } from "@qltysh/fabro-api-client";
|
||||
|
||||
import {
|
||||
buildBoardColumns,
|
||||
|
|
@ -11,15 +11,7 @@ import {
|
|||
shouldRefreshBoardForEvent,
|
||||
} from "./runs";
|
||||
import { summarizeBatchLifecycleAction } from "../components/runs-list/batch-lifecycle";
|
||||
|
||||
function testPrincipal(): Principal {
|
||||
return {
|
||||
kind: "user",
|
||||
identity: { issuer: "fabro:test", subject: "test-user" },
|
||||
login: "test",
|
||||
auth_method: "dev_token",
|
||||
};
|
||||
}
|
||||
import { testPrincipal } from "../lib/test-fixtures";
|
||||
|
||||
function boardRun(id: string, column: BoardColumn, questionText?: string): Run {
|
||||
const status =
|
||||
|
|
|
|||
|
|
@ -177,15 +177,7 @@ pub(crate) fn remote_run_summary_json(
|
|||
"origin_url": null,
|
||||
"provider": "unknown"
|
||||
},
|
||||
"created_by": {
|
||||
"kind": "user",
|
||||
"identity": {
|
||||
"issuer": "fabro:test",
|
||||
"subject": "test-user"
|
||||
},
|
||||
"login": "test",
|
||||
"auth_method": "dev_token"
|
||||
},
|
||||
"created_by": fabro_types::test_support::test_principal(),
|
||||
"origin": {
|
||||
"kind": "api"
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue