chore: initialize from frontend template 4dc033c
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { mapOperationPayload } from "../../src/adapters/http/resource-mapper.ts";
|
||||
import {
|
||||
composeBoundaryMapperRegistry,
|
||||
mappingSuccess,
|
||||
} from "../../src/contracts/boundary-mapper.ts";
|
||||
|
||||
describe("platform DTO mapper boundary", () => {
|
||||
it("fails closed when no feature mapper was injected", () => {
|
||||
expect(mapOperationPayload("UNKNOWN", {})).toEqual({
|
||||
ok: false,
|
||||
code: "MAPPING_INVARIANT_REJECTED",
|
||||
});
|
||||
});
|
||||
|
||||
it("rejects duplicate mapper contributions before installation", () => {
|
||||
const mapper = {
|
||||
mapperId: "ResourceMapper",
|
||||
mapperVersion: 1,
|
||||
inputSchemaId: "ResourcePayload",
|
||||
outputContractId: "Resource",
|
||||
owner: "test",
|
||||
maxOutputItems: 1,
|
||||
map: (input: unknown) => mappingSuccess(input),
|
||||
};
|
||||
expect(() =>
|
||||
composeBoundaryMapperRegistry([
|
||||
{ ResourceMapper: mapper },
|
||||
{ ResourceMapper: mapper },
|
||||
]),
|
||||
).toThrow("duplicate boundary mapper");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user