AshBackendDrivenOptimisticUi. Snapshot
(AshBackendDrivenOptimisticUi v0.1.0)
Copy Markdown
View Source
The committed copy of every rule, one pretty-printed JSON file per
rule at <dir>/<type>.<action>.json, keys sorted so a diff shows only real
changes. AshBackendDrivenOptimisticUi.Test compares against it, mix optimistic_ui.snapshot
rewrites it.
Summary
Functions
The snapshot directory: the :snapshot_dir option, else test/optimistic_ui/__snapshots__.
How dir differs from rules: rules without a file, files whose content differs, files without a rule.
The rule keys that have a file in dir, sorted.
The file holding rule key ("<type>.<action>") in dir.
The file content for rule: key-sorted pretty JSON with a trailing newline.
Writes every rule to dir and deletes files with no rule; returns the keys written and removed.
Functions
The snapshot directory: the :snapshot_dir option, else test/optimistic_ui/__snapshots__.
@spec drift(%{required(String.t()) => term()}, Path.t()) :: %{ missing: [String.t()], changed: [String.t()], stale: [String.t()] }
How dir differs from rules: rules without a file, files whose content differs, files without a rule.
The rule keys that have a file in dir, sorted.
The file holding rule key ("<type>.<action>") in dir.
The file content for rule: key-sorted pretty JSON with a trailing newline.
@spec write(%{required(String.t()) => term()}, Path.t()) :: %{ written: [String.t()], removed: [String.t()] }
Writes every rule to dir and deletes files with no rule; returns the keys written and removed.