Skip to main content

Assert

Inline assertions for Telo manifests — pluggable matchers that compare actual values against expected values inside Test.Suite cases or any sequence step.

Why use this

  • Manifest-native — assertions are resources, not host-language code, so they compose with the same scoping and dependency rules as the rest of your manifest.
  • Drop-in matchersEquals, Matches, Contains cover the common comparisons without writing a controller.
  • Schema-aware checksSchema validates a value against a JSON Schema; Manifest walks structured manifest data and asserts on it.
  • Observability hooksEvents asserts on emitted kernel events for behaviour-level testing.

Kinds

KindPurpose
Assert.EqualsAssert two values are deep-equal.
Assert.MatchesAssert a string matches a regex / pattern.
Assert.ContainsAssert a collection or string contains a value.
Assert.SchemaValidate a value against a JSON Schema.
Assert.ManifestWalk structured manifest data and assert on it.
Assert.EventsAssert on emitted kernel events.
Assert.ModuleContextCapture the module-level context for assertions.

Exported instances

Equals, Matches, and Contains are config-free — the comparison args arrive at invoke time — so the library ships them as ready-made singletons via exports.resources. Reference them with !ref Assert.<name> (including inside a Run.Sequence step) instead of declaring an instance:

ExportKind
Assert.equalsAssert.Equals
Assert.matchesAssert.Matches
Assert.containsAssert.Contains
kind: Run.Sequence
metadata: { name: Check }
steps:
- name: Total
invoke: !ref Assert.equals
inputs:
actual: ${{ steps.Add.result }}
expected: 42

The config-bearing kinds (Schema, Manifest, Events, ModuleContext) carry per-instance state, so they stay instance-per-use and are not exported as singletons.

Example

kind: Telo.Application
metadata: { name: assert-app, version: 1.0.0 }
imports:
Assert: std/assert@latest
---
kind: Assert.Equals
metadata: { name: CheckTotal }
expected: 42
actual: !cel "resources.AddNumbers.result"

Reference