diff --git a/server/src/__tests__/computer-environment-selection.test.ts b/server/src/__tests__/computer-environment-selection.test.ts deleted file mode 100644 index 31dacb9a31..0000000000 --- a/server/src/__tests__/computer-environment-selection.test.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { describe, expect, it } from "vitest"; -import { assertEnvironmentSelectionForCompany } from "../services/environment-selection.js"; - -describe("computer environment selection", () => { - const environment = { id: "environment", driver: "computer", status: "active", config: {}, metadata: { computerCompanyId: "owner" } }; - const service = { getById: async () => environment }; - it("permits the attached company and rejects another company", async () => { - await expect(assertEnvironmentSelectionForCompany(service, "owner", "environment")).resolves.toBeUndefined(); - await expect(assertEnvironmentSelectionForCompany(service, "other", "environment")).rejects.toThrow("not available in this company"); - }); -}); diff --git a/server/src/services/computer-environment-driver.test.ts b/server/src/services/computer-environment-driver.test.ts index 186e2ee72c..ee045ad347 100644 --- a/server/src/services/computer-environment-driver.test.ts +++ b/server/src/services/computer-environment-driver.test.ts @@ -1,6 +1,7 @@ import { describe, expect, it, vi } from "vitest"; import { resolveEnvironmentExecutionTarget, resolveEnvironmentExecutionTransport } from "./environment-execution-target.js"; import { createComputerEnvironmentDriver } from "./computer-environment-driver.js"; +import { assertEnvironmentSelectionForCompany } from "./environment-selection.js"; const state = vi.hoisted(() => { const binding = { owner: { computerId: "computer", ownerId: "owner", generation: 1 }, @@ -44,3 +45,12 @@ describe("computer environment probe ownership", () => { expect(state.acquireLease).toHaveBeenCalledWith(expect.objectContaining({ heartbeatRunId: null, providerLeaseId: "owner", metadata: expect.objectContaining({ driver: "computer", computerOwner: { computerId: "computer", ownerId: "owner", generation: 1 } }) })); }); }); + +describe("computer environment selection", () => { + const environment = { id: "environment", driver: "computer", status: "active", config: {}, metadata: { computerCompanyId: "owner" } }; + const service = { getById: async () => environment }; + it("permits the attached company and rejects another company", async () => { + await expect(assertEnvironmentSelectionForCompany(service, "owner", "environment")).resolves.toBeUndefined(); + await expect(assertEnvironmentSelectionForCompany(service, "other", "environment")).rejects.toThrow("not available in this company"); + }); +});