ConusAI vendor v0.1.0-beta.114
ci / gate (push) Waiting to run

This commit is contained in:
ConusAI vendor v0.1.0-beta.114
2026-11-14 09:56:45 +00:00
commit 1ce8d23c35
867 changed files with 122104 additions and 0 deletions
+50
View File
@@ -0,0 +1,50 @@
// SPDX-License-Identifier: LicenseRef-ConusAI-Template-1.0
// Deployment credentials and an unverified tuple cannot establish app authority.
import { BUSINESS_REQUEST_BINDING } from "@conusai-kit/business"
import { Container } from "@conusai-kit/core"
import { describe, expect, it, vi } from "vitest"
import { activitiesServiceOf } from "../modules/activities/adapters/service.js"
import { archiveServiceOf } from "../modules/archive/adapters/service.js"
import { catalogServiceOf } from "../modules/catalog/adapters/service.js"
import { crmServiceOf } from "../modules/crm/adapters/service.js"
import { inventoryServiceOf } from "../modules/inventory/adapters/service.js"
const env = {
CONUSAI_API_URL: "https://cloud.example.test/api",
CONUSAI_API_TOKEN: "synthetic-deployment-token",
CONUSAI_PROJECT_ID: "7",
CONUSAI_ORG_SLUG: "fixture",
}
describe("business service app partition admission", () => {
for (const [name, resolve] of Object.entries({
activities: activitiesServiceOf,
archive: archiveServiceOf,
catalog: catalogServiceOf,
crm: crmServiceOf,
inventory: inventoryServiceOf,
})) {
it(`${name} refuses an absent or unverified request binding before network dispatch`, () => {
for (const [key, value] of Object.entries(env)) vi.stubEnv(key, value)
const fetch = vi.spyOn(globalThis, "fetch")
try {
const unbound = new Container()
const forged = new Container()
forged.value(BUSINESS_REQUEST_BINDING, {
bindingId: "01900000-0000-7000-8000-000000000001",
orgSlug: "fixture",
client: () => {
throw new Error("unverified client must never be constructed")
},
} as never)
for (const container of [unbound, forged])
expect(() => resolve(container, "read")).toThrow(
expect.objectContaining({ code: "service_partition_missing", status: 409 }),
)
expect(fetch).not.toHaveBeenCalled()
} finally {
fetch.mockRestore()
vi.unstubAllEnvs()
}
})
}
})