chore: bump Bun version
This commit is contained in:
parent
a7c6808583
commit
48a55c0183
5 changed files with 71 additions and 48 deletions
|
|
@ -8,7 +8,7 @@ runs:
|
||||||
- uses: oven-sh/setup-bun@v2
|
- uses: oven-sh/setup-bun@v2
|
||||||
name: Install Bun
|
name: Install Bun
|
||||||
with:
|
with:
|
||||||
bun-version: "1.3.6"
|
bun-version: "1.3.11"
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
ARG BUN_VERSION="1.3.6"
|
ARG BUN_VERSION="1.3.11"
|
||||||
|
|
||||||
FROM oven/bun:${BUN_VERSION}-alpine AS base
|
FROM oven/bun:${BUN_VERSION}-alpine AS base
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,13 @@
|
||||||
import type { ReactNode } from "react";
|
import type { ReactNode } from "react";
|
||||||
import { afterEach, describe, expect, mock, test } from "bun:test";
|
import { afterEach, describe, expect, mock, test } from "bun:test";
|
||||||
import { cleanup, render, screen } from "@testing-library/react";
|
import { HttpResponse, http, server } from "~/test/msw/server";
|
||||||
|
import { cleanup, render, screen, waitFor } from "~/test/test-utils";
|
||||||
import { fromAny } from "@total-typescript/shoehorn";
|
import { fromAny } from "@total-typescript/shoehorn";
|
||||||
|
|
||||||
await mock.module("@tanstack/react-router", () => ({
|
await mock.module("@tanstack/react-router", () => ({
|
||||||
Link: ({ children }: { children?: ReactNode }) => <a href="/">{children}</a>,
|
Link: ({ children }: { children?: ReactNode }) => <a href="/">{children}</a>,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
await mock.module("~/client/components/file-browsers/snapshot-tree-browser", () => ({
|
|
||||||
SnapshotTreeBrowser: ({ queryBasePath, displayBasePath }: { queryBasePath?: string; displayBasePath?: string }) => (
|
|
||||||
<div>{`query:${queryBasePath ?? "missing"} display:${displayBasePath ?? "missing"}`}</div>
|
|
||||||
),
|
|
||||||
}));
|
|
||||||
|
|
||||||
await mock.module("~/client/lib/datetime", () => ({
|
await mock.module("~/client/lib/datetime", () => ({
|
||||||
useTimeFormat: () => ({
|
useTimeFormat: () => ({
|
||||||
formatDateTime: () => "2026-03-26 00:00",
|
formatDateTime: () => "2026-03-26 00:00",
|
||||||
|
|
@ -23,11 +18,26 @@ import { SnapshotFileBrowser } from "../snapshot-file-browser";
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
cleanup();
|
cleanup();
|
||||||
mock.restore();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("SnapshotFileBrowser", () => {
|
describe("SnapshotFileBrowser", () => {
|
||||||
test("uses the snapshot common ancestor as query root while keeping a broader display root", () => {
|
test("uses the snapshot common ancestor as query root while keeping a broader display root", async () => {
|
||||||
|
const requests: string[] = [];
|
||||||
|
|
||||||
|
server.use(
|
||||||
|
http.get("/api/v1/repositories/:shortId/snapshots/:snapshotId/files", ({ request }) => {
|
||||||
|
const url = new URL(request.url);
|
||||||
|
requests.push(url.searchParams.get("path") ?? "");
|
||||||
|
|
||||||
|
return HttpResponse.json({
|
||||||
|
files: [
|
||||||
|
{ name: "subdir", path: "/mnt/project/subdir", type: "dir" },
|
||||||
|
{ name: "a.txt", path: "/mnt/project/subdir/a.txt", type: "file" },
|
||||||
|
],
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
render(
|
render(
|
||||||
<SnapshotFileBrowser
|
<SnapshotFileBrowser
|
||||||
snapshot={fromAny({
|
snapshot={fromAny({
|
||||||
|
|
@ -41,6 +51,10 @@ describe("SnapshotFileBrowser", () => {
|
||||||
/>,
|
/>,
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(screen.getByText("query:/mnt/project/subdir display:/mnt")).toBeTruthy();
|
await waitFor(() => {
|
||||||
|
expect(requests[0]).toBe("/mnt/project/subdir");
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(await screen.findByRole("button", { name: "project" })).toBeTruthy();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,43 @@
|
||||||
|
import type { ReactNode } from "react";
|
||||||
import { afterEach, describe, expect, mock, test } from "bun:test";
|
import { afterEach, describe, expect, mock, test } from "bun:test";
|
||||||
import { fromAny } from "@total-typescript/shoehorn";
|
import { fromAny } from "@total-typescript/shoehorn";
|
||||||
import { HttpResponse, http, server } from "~/test/msw/server";
|
import { HttpResponse, http, server } from "~/test/msw/server";
|
||||||
import { cleanup, render, screen } from "~/test/test-utils";
|
import { cleanup, render, screen } from "~/test/test-utils";
|
||||||
|
|
||||||
|
await mock.module("@tanstack/react-router", () => ({
|
||||||
|
Link: ({ children }: { children?: ReactNode }) => <a href="/">{children}</a>,
|
||||||
|
useNavigate: () => mock(() => {}),
|
||||||
|
useSearch: () => ({}),
|
||||||
|
}));
|
||||||
|
|
||||||
|
await mock.module("~/client/components/backup-summary-card", () => ({
|
||||||
|
BackupSummaryCard: () => null,
|
||||||
|
}));
|
||||||
|
|
||||||
|
await mock.module("~/client/modules/backups/components/schedule-summary", () => ({
|
||||||
|
ScheduleSummary: () => null,
|
||||||
|
}));
|
||||||
|
|
||||||
|
await mock.module("~/client/modules/backups/components/snapshot-timeline", () => ({
|
||||||
|
SnapshotTimeline: () => null,
|
||||||
|
}));
|
||||||
|
|
||||||
|
await mock.module("~/client/modules/backups/components/schedule-notifications-config", () => ({
|
||||||
|
ScheduleNotificationsConfig: () => null,
|
||||||
|
}));
|
||||||
|
|
||||||
|
await mock.module("~/client/modules/backups/components/schedule-mirrors-config", () => ({
|
||||||
|
ScheduleMirrorsConfig: () => null,
|
||||||
|
}));
|
||||||
|
|
||||||
|
await mock.module("~/client/lib/datetime", () => ({
|
||||||
|
useTimeFormat: () => ({
|
||||||
|
formatDateTime: () => "2026-03-26 00:00",
|
||||||
|
}),
|
||||||
|
}));
|
||||||
|
|
||||||
|
import { ScheduleDetailsPage } from "../backup-details";
|
||||||
|
|
||||||
const schedule = {
|
const schedule = {
|
||||||
shortId: "backup-1",
|
shortId: "backup-1",
|
||||||
name: "Backup 1",
|
name: "Backup 1",
|
||||||
|
|
@ -32,39 +67,6 @@ const snapshot = {
|
||||||
summary: {},
|
summary: {},
|
||||||
};
|
};
|
||||||
|
|
||||||
await mock.module("@tanstack/react-router", () => ({
|
|
||||||
useNavigate: () => mock(() => {}),
|
|
||||||
useSearch: () => ({}),
|
|
||||||
}));
|
|
||||||
|
|
||||||
await mock.module("~/client/components/backup-summary-card", () => ({
|
|
||||||
BackupSummaryCard: () => null,
|
|
||||||
}));
|
|
||||||
|
|
||||||
await mock.module("~/client/modules/backups/components/schedule-summary", () => ({
|
|
||||||
ScheduleSummary: () => null,
|
|
||||||
}));
|
|
||||||
|
|
||||||
await mock.module("~/client/modules/backups/components/snapshot-file-browser", () => ({
|
|
||||||
SnapshotFileBrowser: ({ displayBasePath }: { displayBasePath?: string }) => (
|
|
||||||
<div>{displayBasePath ? `display-base-path:${displayBasePath}` : "display-base-path:missing"}</div>
|
|
||||||
),
|
|
||||||
}));
|
|
||||||
|
|
||||||
await mock.module("~/client/modules/backups/components/snapshot-timeline", () => ({
|
|
||||||
SnapshotTimeline: () => null,
|
|
||||||
}));
|
|
||||||
|
|
||||||
await mock.module("~/client/modules/backups/components/schedule-notifications-config", () => ({
|
|
||||||
ScheduleNotificationsConfig: () => null,
|
|
||||||
}));
|
|
||||||
|
|
||||||
await mock.module("~/client/modules/backups/components/schedule-mirrors-config", () => ({
|
|
||||||
ScheduleMirrorsConfig: () => null,
|
|
||||||
}));
|
|
||||||
|
|
||||||
import { ScheduleDetailsPage } from "../backup-details";
|
|
||||||
|
|
||||||
const mockScheduleDetailsRequests = () => {
|
const mockScheduleDetailsRequests = () => {
|
||||||
server.use(
|
server.use(
|
||||||
http.get("/api/v1/backups/:shortId", () => {
|
http.get("/api/v1/backups/:shortId", () => {
|
||||||
|
|
@ -73,12 +75,19 @@ const mockScheduleDetailsRequests = () => {
|
||||||
http.get("/api/v1/repositories/:shortId/snapshots", () => {
|
http.get("/api/v1/repositories/:shortId/snapshots", () => {
|
||||||
return HttpResponse.json([snapshot]);
|
return HttpResponse.json([snapshot]);
|
||||||
}),
|
}),
|
||||||
|
http.get("/api/v1/repositories/:shortId/snapshots/:snapshotId/files", () => {
|
||||||
|
return HttpResponse.json({
|
||||||
|
files: [
|
||||||
|
{ name: "project", path: "/mnt/project", type: "dir" },
|
||||||
|
{ name: "a.txt", path: "/mnt/project/a.txt", type: "file" },
|
||||||
|
],
|
||||||
|
});
|
||||||
|
}),
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
cleanup();
|
cleanup();
|
||||||
mock.restore();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("ScheduleDetailsPage", () => {
|
describe("ScheduleDetailsPage", () => {
|
||||||
|
|
@ -103,6 +112,6 @@ describe("ScheduleDetailsPage", () => {
|
||||||
{ withSuspense: true },
|
{ withSuspense: true },
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(await screen.findByText("display-base-path:/mnt")).toBeTruthy();
|
expect(await screen.findByRole("button", { name: "project" })).toBeTruthy();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -140,5 +140,5 @@
|
||||||
"overrides": {
|
"overrides": {
|
||||||
"esbuild": "^0.27.2"
|
"esbuild": "^0.27.2"
|
||||||
},
|
},
|
||||||
"packageManager": "bun@1.3.6"
|
"packageManager": "bun@1.3.11"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue