mirror of
https://github.com/getpaseo/paseo.git
synced 2026-12-03 21:56:41 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
32cae04627 |
@@ -2,7 +2,7 @@ import type pino from "pino";
|
||||
import type { SubscribeCheckoutDiffRequest, SessionOutboundMessage } from "./messages.js";
|
||||
import type { WorkspaceGitService } from "./workspace-git-service.js";
|
||||
import type { WorkspaceRuntimeStore } from "./workspace-runtime-store/index.js";
|
||||
import { DiffReadError, DiffSubscriptions, type CommitFileRead } from "./diff/index.js";
|
||||
import { DiffSubscriptions, type CommitFileRead } from "./diff/index.js";
|
||||
import {
|
||||
DiffOpcode,
|
||||
materializeDiffFile,
|
||||
@@ -169,11 +169,7 @@ export class CheckoutDiffManager {
|
||||
await subscription.start();
|
||||
return { initial: await initial, unsubscribe };
|
||||
} catch (error) {
|
||||
const checkoutError =
|
||||
error instanceof DiffReadError && error.code === "NOT_GIT_REPO"
|
||||
? { code: error.code, message: error.message }
|
||||
: toCheckoutError(error);
|
||||
return { initial: { cwd, files: [], error: checkoutError }, unsubscribe() {} };
|
||||
return { initial: { cwd, files: [], error: toCheckoutError(error) }, unsubscribe() {} };
|
||||
}
|
||||
}
|
||||
scheduleRefreshForCwd(cwd: string): Promise<void> {
|
||||
|
||||
@@ -70,29 +70,6 @@ afterEach(async () => {
|
||||
await ctx.cleanup();
|
||||
}, 60000);
|
||||
|
||||
test("preserves the non-git directory error in legacy checkout diff subscriptions", async () => {
|
||||
const cwd = tmpCwd();
|
||||
const subscription = ctx.client.observeCheckoutDiff(cwd, { mode: "uncommitted" });
|
||||
|
||||
try {
|
||||
expect(
|
||||
await ctx.client.readDiff({
|
||||
cwd,
|
||||
base: { kind: "rev", rev: "HEAD" },
|
||||
head: { kind: "worktree" },
|
||||
}),
|
||||
).toMatchObject({ phase: "error", error: { code: "NOT_GIT_REPO" } });
|
||||
|
||||
expect(await subscription.ready).toMatchObject({
|
||||
files: [],
|
||||
error: { code: "NOT_GIT_REPO" },
|
||||
});
|
||||
} finally {
|
||||
await subscription.release();
|
||||
rmSync(cwd, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
test("pushes file-level checkout diff updates with deterministic path order", async () => {
|
||||
const cwd = tmpCwd();
|
||||
|
||||
|
||||
@@ -488,7 +488,6 @@ function diffError(error: unknown): DiffError {
|
||||
};
|
||||
}
|
||||
|
||||
export { DiffReadError } from "./git.js";
|
||||
export { DiffSession } from "./session.js";
|
||||
|
||||
function endpointKey(endpoint: DiffEndpoint): string[] {
|
||||
|
||||
@@ -185,9 +185,7 @@ test("filters by search and clears to all plugins", async ({ page }) => {
|
||||
|
||||
await submitSearch(page, "graphite");
|
||||
await expect(page).toHaveURL(/\/plugins\/all\?q=graphite$/);
|
||||
await expect(
|
||||
page.getByRole("heading", { level: 1, name: /^Results for “graphite”/ }),
|
||||
).toBeVisible();
|
||||
await expectSearchResultsAfterDirectory(page, "graphite");
|
||||
await expect(page.getByRole("main").getByRole("link", { name: /Graphite/ })).toBeVisible();
|
||||
await expect(page.getByRole("link", { name: /Dracula/ })).toHaveCount(0);
|
||||
|
||||
@@ -217,10 +215,7 @@ test("submits the visible search term when its input event was missed", async ({
|
||||
await page.keyboard.press("Enter");
|
||||
|
||||
await expect(page).toHaveURL(/\/plugins\/all\?q=graphite&window=month$/);
|
||||
// The URL changes before the results route finishes loading its data and code.
|
||||
await expect(
|
||||
page.getByRole("heading", { level: 1, name: /^Results for “graphite”/ }),
|
||||
).toBeVisible({ timeout: 10000 });
|
||||
await expectSearchResultsAfterDirectory(page, "graphite");
|
||||
await expect(page.getByRole("link", { name: "This month" })).toHaveAttribute(
|
||||
"aria-current",
|
||||
"true",
|
||||
@@ -286,7 +281,7 @@ test("searches from the directory on submit, and Back returns to the directory",
|
||||
|
||||
await page.keyboard.press("Enter");
|
||||
await expect(page).toHaveURL(/\/plugins\/all\?q=gra$/);
|
||||
await expect(page.getByRole("heading", { level: 1, name: /^Results for “gra”/ })).toBeVisible();
|
||||
await expectSearchResultsAfterDirectory(page, "gra");
|
||||
expect(await historyLength(page)).toBe(entries + 1);
|
||||
|
||||
await page.goBack();
|
||||
@@ -501,6 +496,14 @@ async function expectDirectorySearch(page: Page, term: string, window: string) {
|
||||
);
|
||||
}
|
||||
|
||||
// The URL changes as soon as the directory submits, but the results route shows only after
|
||||
// its registry server call returns. On a loaded CI runner that call has taken over 4 s.
|
||||
async function expectSearchResultsAfterDirectory(page: Page, term: string) {
|
||||
await expect(
|
||||
page.getByRole("heading", { level: 1, name: new RegExp(`^Results for “${term}”`) }),
|
||||
).toBeVisible({ timeout: 10000 });
|
||||
}
|
||||
|
||||
async function typeSearch(page: Page, term: string) {
|
||||
await page.getByRole("searchbox", { name: "Search plugins" }).pressSequentially(term);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user