DiffoExample.Util (DiffoExample v0.2.3)

Copy Markdown View Source

Cross-domain projection helpers for the diffo_example app.

Mirrors Diffo.Util in shape: each function is a projection — it collapses values in a JSON payload to a coarser semantic form so comparisons stay meaningful at the projected level. Apply the same projection to both sides of a comparison.

Summary

Functions

Project the *Characteristic arrays in a JSON payload to a coarser form derived from instance's declarations.

Functions

summarise_characteristics(payload, instance)

Project the *Characteristic arrays in a JSON payload to a coarser form derived from instance's declarations.

General-purpose projection helper for comparing TMF payloads at the names-only level, ignoring the specific values carried by typed characteristic records and pool records. Reads the declared characteristic, pool and feature characteristic names from the instance's module and replaces each named characteristic array with a sorted list of %{"name" => name, "value" => "absent_characteristic"} entries. Applied to both sides of a comparison, names align and rich values collapse to the same placeholder.

Useful for demonstrating projections — coarsening test assertions to the structural shape (which characteristics are declared and surface) without coupling them to the values those characteristics happen to carry on a given run.

Modelled after Diffo.Util.summarise_dates/1.