36 lines
1.4 KiB
TypeScript
36 lines
1.4 KiB
TypeScript
import { expect, test } from "bun:test";
|
|
|
|
import { featureConfigSchemaHistoryFields, renderFeatureConfigSchemaLine } from "./platform-infra-pac-feature-config-projection";
|
|
|
|
test("status and debug share one bounded feature config line", () => {
|
|
const observation = {
|
|
warning: true,
|
|
blocking: false,
|
|
code: "feature-config-value-mismatch",
|
|
schemaPath: "config/feature-config.schema.json",
|
|
errorCount: 2,
|
|
firstError: " /webProbeSentinel required must have required property ",
|
|
};
|
|
const line = renderFeatureConfigSchemaLine(observation);
|
|
expect(line).toBe(" feature-config-schema: warning=true blocking=false code=feature-config-value-mismatch path=config/feature-config.schema.json errors=2 first=/webProbeSentinel required must have required property");
|
|
expect(line.length).toBeLessThan(300);
|
|
});
|
|
|
|
test("history uses the same bounded observation fields", () => {
|
|
expect(featureConfigSchemaHistoryFields({
|
|
warning: true,
|
|
blocking: false,
|
|
code: "feature-config-schema-missing",
|
|
schemaPath: "config/feature-config.schema.json",
|
|
errorCount: 1,
|
|
firstError: "schema file is missing",
|
|
})).toEqual([
|
|
["featureConfigWarning", "true"],
|
|
["featureConfigBlocking", "false"],
|
|
["featureConfigCode", "feature-config-schema-missing"],
|
|
["featureConfigSchemaPath", "config/feature-config.schema.json"],
|
|
["featureConfigErrorCount", "1"],
|
|
["featureConfigFirstError", "schema file is missing"],
|
|
]);
|
|
});
|