Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

README.md

@itxtech/fdnext-contract-test

Result contract and schema validation test suite for fdnext.

Overview

packages/contract-test validates that the fdnext engine's output conforms to the published result schemas (fdnext.result.v1 and fdnext.capabilities.v2). It provides:

  • Schema Validator — A lightweight JSON Schema validator (validateSchema) that checks fdnext results against their declared schemas without external dependencies.
  • Contract ChecksrunContractChecks() exercises all core operations (part decode, part search, identifier decode, identifier search, capabilities) and validates each response against the schema.
  • Contract EnginecreateContractEngine() assembles a fully-configured engine with default DecodePack and embedded resources for testing.

The current repository build only emits declarations for this package. Package metadata intentionally does not declare a runtime main / exports target until a publish bundle is added.

Usage

Run Contract Checks

pnpm -C packages/contract-test test

Or from the monorepo root:

pnpm contract:check

DRAM part-search de-duplication is intentionally outside the default contract suite. Run it when adding or changing DRAM PN resources, FBGA markings, or search suggestion behavior:

pnpm -C packages/contract-test test:part-search:dram

Source API

import { runContractChecks, validateSchema, createContractEngine } from "./src/index";

// Run all contract checks
const summary = runContractChecks();
console.log(`Checked ${summary.checked} operations: ${summary.operations.join(", ")}`);

// Validate a single result against the schema
import { fdnextResultJsonSchema } from "@itxtech/fdnext-core";
const errors = validateSchema(fdnextResultJsonSchema, someResult);

Fixtures

The fixtures/ directory contains reference response snapshots used by the contract test suite.

Documentation

  • Server API — Response schema and contract documentation

License

AGPL-3.0-or-later — See LICENSE for details.