Skip to Content
Conformance Testing

Conformance Testing

The UN/CEFACT Verifiable Trade Documents specification ships with a test suite that implementers can run against their own issued documents to verify conformance. The suite is written in Jest.

The schemas and JSON-LD contexts are part of the standard and are referenced by URL inside each issued document — implementers do not provide these. The test suite validates your issued credentials against them.

Prerequisites

  • Node.js 18
  • npm

Setup

Clone the specification repository and install dependencies:

git clone https://opensource.unicc.org/un/unece/uncefact/spec-unvtd cd spec-unvtd npm install

Pointing the suite at your documents

Replace the *-example.json files in public/ with your own issued credentials, following the same naming convention:

public/ commercial-invoice-example.json bill-of-lading-example.json ...

Each file must be a valid JSON document containing @context and credentialSchema.id fields pointing to the standard’s published URLs — as they would in any conformant issued credential.

Running the tests

npm test

What is checked

For each issued document, the suite verifies:

Structure (based on W3C VC Data Model v2.0 )

  • Required W3C VC fields are present: issuer, credentialSubject, validFrom, validTo
  • @context and credentialSchema fields are defined and correctly typed
  • The document validates against the schema referenced in credentialSchema.id

LD Link Resolution

  • The @context URL resolves with HTTP 200 and returns valid JSON-LD
  • The credentialSchema.id URL resolves with HTTP 200 and returns valid schema content

These tests require network access and have a 30-second timeout per request.

Interpreting results

A passing run confirms that your issued credentials are structurally conformant with the specification and that all Linked Data references are live and resolvable. This is a prerequisite for your documents to be verifiable by third parties.

If the LD link resolution tests fail, verifiers will not be able to retrieve the context or schema needed to validate your credentials — even if the document structure is otherwise correct.

What is not tested

Cryptographic suite, signing method, DID method, and revocation mechanism are outside the scope of this test suite and are not compliance requirements of this specification. Implementers should follow Postel’s Law : be conservative in what you send, liberal in what you accept — offer a single well-supported implementation, but design your systems to accept credentials signed with other widely-used methods.

Last updated on