Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ vi.mock("@vercel/blob", () => ({
get: mocks.getBlob,
}));

import { prepareLinqBrowserImageDelivery } from "../agent/lib/linq-browser-image-delivery";
import { prepareLinqBrowserImageDelivery } from "../linq-browser-image-delivery";

const scope = { userId: "user-1", workspaceId: "workspace-1" };

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* oxlint-disable vitest/require-mock-type-parameters -- The hoisted Kernel fake records cleanup request options. */
import { describe, expect, it, vi } from "vitest";
import { withVaultScreenshotMask } from "../agent/subagents/worker/lib/vault-screenshot-mask";
import { withVaultScreenshotMask } from "../vault-screenshot-mask";

const playwrightExecuteMock =
vi.fn<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ function createDatabase() {

async function applyMigration(database: PGlite, name: string) {
const migration = await readFile(
new URL(`../db/migrations/${name}`, import.meta.url),
new URL(`../migrations/${name}`, import.meta.url),
"utf8"
);
for (const statement of migration.split("--> statement-breakpoint")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
verification,
workspaceMemberships,
workspaces,
} from "../db/schema";
} from "../schema";

describe("database schema", () => {
it("owns the application and Better Auth tables", () => {
Expand Down Expand Up @@ -119,7 +119,7 @@ describe("migration deployment policy", () => {
})
.parse(
JSON.parse(
await readFile(new URL("../package.json", import.meta.url), "utf8")
await readFile(new URL("../../package.json", import.meta.url), "utf8")
)
);
const turbo = z
Expand All @@ -134,14 +134,14 @@ describe("migration deployment policy", () => {
})
.parse(
JSON.parse(
await readFile(new URL("../turbo.json", import.meta.url), "utf8")
await readFile(new URL("../../turbo.json", import.meta.url), "utf8")
)
);
const vercel = z
.object({ buildCommand: z.string() })
.parse(
JSON.parse(
await readFile(new URL("../vercel.json", import.meta.url), "utf8")
await readFile(new URL("../../vercel.json", import.meta.url), "utf8")
)
);

Expand All @@ -165,7 +165,7 @@ describe("migration deployment policy", () => {

it("adopts existing tables without request-time DDL", async () => {
const migration = await readFile(
new URL("../db/migrations/0000_fluffy_the_spike.sql", import.meta.url),
new URL("../migrations/0000_fluffy_the_spike.sql", import.meta.url),
"utf8"
);
const services = await Promise.all(
Expand All @@ -181,17 +181,17 @@ describe("migration deployment policy", () => {
].map(
async (name) =>
await readFile(
new URL(`../db/services/${name}.ts`, import.meta.url),
new URL(`../services/${name}.ts`, import.meta.url),
"utf8"
)
)
);
const authSource = await readFile(
new URL("../src/auth/index.ts", import.meta.url),
new URL("../../src/auth/index.ts", import.meta.url),
"utf8"
);
const authMigration = await readFile(
new URL("../db/migrations/0001_better-auth.sql", import.meta.url),
new URL("../migrations/0001_better-auth.sql", import.meta.url),
"utf8"
);

Expand Down
12 changes: 6 additions & 6 deletions tests/services.test.ts → db/tests/services.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { eq } from "drizzle-orm";
import { drizzle } from "drizzle-orm/pglite";
import { afterEach, describe, expect, it, vi } from "vitest";
import * as Database from "@/db";
import * as schema from "../db/schema";
import * as schema from "../schema";
import {
browserTraceDomains as browserTraceDomainsTable,
browserTraces as browserTracesTable,
} from "../db/schema";
} from "../schema";

const databases: PGlite[] = [];

Expand Down Expand Up @@ -352,7 +352,7 @@ describe("database services", () => {

async function applyInitialMigration(database: PGlite) {
const migration = await readFile(
new URL("../db/migrations/0000_fluffy_the_spike.sql", import.meta.url),
new URL("../migrations/0000_fluffy_the_spike.sql", import.meta.url),
"utf8"
);
for (const statement of migration.split("--> statement-breakpoint")) {
Expand All @@ -362,7 +362,7 @@ async function applyInitialMigration(database: PGlite) {

async function applyBrowserImageMigration(database: PGlite) {
const migration = await readFile(
new URL("../db/migrations/0003_unusual_fabian_cortez.sql", import.meta.url),
new URL("../migrations/0003_unusual_fabian_cortez.sql", import.meta.url),
"utf8"
);
for (const statement of migration.split("--> statement-breakpoint")) {
Expand All @@ -372,7 +372,7 @@ async function applyBrowserImageMigration(database: PGlite) {

async function applyBrowserTraceMigration(database: PGlite) {
const migration = await readFile(
new URL("../db/migrations/0004_kind_manta.sql", import.meta.url),
new URL("../migrations/0004_kind_manta.sql", import.meta.url),
"utf8"
);
for (const statement of migration.split("--> statement-breakpoint")) {
Expand All @@ -382,7 +382,7 @@ async function applyBrowserTraceMigration(database: PGlite) {

async function applyBrowserTraceEventMigration(database: PGlite) {
const migration = await readFile(
new URL("../db/migrations/0005_brave_kang.sql", import.meta.url),
new URL("../migrations/0005_brave_kang.sql", import.meta.url),
"utf8"
);
for (const statement of migration.split("--> statement-breakpoint")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe("browser benchmark environment", () => {
});

it("provides benchmark defaults independently of the runtime environment", async () => {
const { browserBenchmarkEnv } = await import("../evals/browser/env");
const { browserBenchmarkEnv } = await import("../env");

expect(browserBenchmarkEnv.BROWSER_BENCH_LABEL).toBeUndefined();
expect(browserBenchmarkEnv.BROWSER_BENCH_REPETITIONS).toBe(1);
Expand All @@ -23,7 +23,7 @@ describe("browser benchmark environment", () => {
it("validates the repetition count", async () => {
vi.stubEnv("BROWSER_BENCH_REPETITIONS", "21");

await expect(import("../evals/browser/env")).rejects.toThrow(
await expect(import("../env")).rejects.toThrow(
"Invalid environment variables"
);
});
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { beforeEach, describe, expect, it, vi } from "vitest";
import { authSessionDependencies, getAuthSession } from "@/auth/session";
import { authSessionFor } from "./helpers/auth-session";
import { authSessionFor } from "@/tests/helpers/auth-session";

const getSessionMock = vi.spyOn(authSessionDependencies, "getSession");

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import type { RouteHandlerArgs } from "eve/channels";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import * as AuthSession from "@/auth/session";
import * as SessionService from "@/db/services/sessions";
import { authSessionFor } from "./helpers/auth-session";
import eveChannel from "../agent/channels/eve";
import { authSessionFor } from "@/tests/helpers/auth-session";
import eveChannel from "@/agent/channels/eve";

const getAuthSessionMock = vi.spyOn(AuthSession, "getAuthSession");
const isSessionOwnedMock = vi.spyOn(SessionService, "isSessionOwned");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import type { HookContext } from "eve/hooks";
import { describe, expect, it, vi } from "vitest";
import type * as Blob from "@vercel/blob";
import type { AccessScope } from "@/lib/access-scope";
import { linqChannelConfig } from "../agent/channels/linq";
import workerCancellationHook from "../agent/hooks/worker-cancellation-delivery";
import workerCancellationHook from "@/agent/hooks/worker-cancellation-delivery";
import { linqChannelConfig } from "@/agent/channels/linq";

interface BrowserImage {
bytes: Uint8Array;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { beforeEach, describe, expect, it, vi } from "vitest";
import type { HookContext } from "eve/hooks";
import sessionOwner, {
sessionOwnerDependencies,
} from "../agent/hooks/session-owner";
} from "@/agent/hooks/session-owner";

const saveChatMock = vi.spyOn(sessionOwnerDependencies, "saveChat");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { z } from "zod";
import { domainFromUrl } from "@/agent/subagents/worker/lib/trace/domains";
import traceTelemetry, {
traceTelemetryDependencies,
} from "../agent/subagents/worker/hooks/trace-telemetry";
} from "@/agent/subagents/worker/hooks/trace-telemetry";

const beginBrowserTraceMock = vi.spyOn(
traceTelemetryDependencies,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { beforeEach, describe, expect, it, vi } from "vitest";
import { z } from "zod";
import { kernel } from "@/lib/kernel";
import { toolContextFor } from "./helpers/tool-context";
import { toolContextFor } from "@/tests/helpers/tool-context";
import manageBrowsers, {
createManageBrowsers,
kernelProfileNameForWorkspace,
manageBrowsersDependencies,
} from "../agent/subagents/worker/tools/manage_browsers";
} from "@/agent/subagents/worker/tools/manage_browsers";

type ListKernelBrowsers = NonNullable<
Parameters<typeof createManageBrowsers>[0]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* oxlint-disable anti-slop/no-module-mocking, typescript/no-unsafe-type-assertion, vitest/require-mock-type-parameters -- The tool owns Kernel and Blob I/O. These fakes isolate external APIs without adding a production wrapper. */
import { beforeEach, describe, expect, it, vi } from "vitest";
import { toolContextFor } from "./helpers/tool-context";
import { toolContextFor } from "@/tests/helpers/tool-context";

const artifactId = "0d01e667-d128-4bb7-a248-1ae21db72f4f";
const png = new Uint8Array([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]);
Expand Down Expand Up @@ -58,7 +58,7 @@ vi.mock("@/lib/kernel", () => ({
},
}));

import captureBrowserImage from "../agent/subagents/worker/tools/capture_browser_image";
import captureBrowserImage from "@/agent/subagents/worker/tools/capture_browser_image";

const scope = { userId: "user-1", workspaceId: "workspace-1" };
const reservation = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { z } from "zod";
import * as WorkerAccess from "@/agent/subagents/worker/lib/access";
import * as OwnedBrowser from "@/agent/subagents/worker/lib/owned-browser";
import { kernel } from "@/lib/kernel";
import { toolContextFor } from "./helpers/tool-context";
import computerAction from "../agent/subagents/worker/tools/computer_action";
import executePlaywrightCode from "../agent/subagents/worker/tools/execute_playwright_code";
import { toolContextFor } from "@/tests/helpers/tool-context";
import computerAction from "@/agent/subagents/worker/tools/computer_action";
import executePlaywrightCode from "@/agent/subagents/worker/tools/execute_playwright_code";

const mocks = {
batch: vi.spyOn(kernel.browsers.computer, "batch"),
Expand Down