Module

Test.Spec.Assertions.DeepDiff

Package
purescript-assertions-deepdiff
Repository
cyrbon/purescript-assertions-deepdiff

Contains assertions about JS objects using deep diffs. Useful for checking validity of types, data corruption, and detecting invalid structure, especially when unsafe code is used.

#ObjectDiff Source

#deepDiff Source

deepDiff :: forall obj2 obj1. obj1 -> obj2 -> ObjectDiff

#Change Source

type Change = { changeType :: String, path :: String }

#getFirstChangeFromDiff Source

getFirstChangeFromDiff :: ObjectDiff -> Maybe Change

Get the path to the first change in a diff, and the type of that change. E.g., { path: "key1.subkey1", changeType: "changed" }

#findFirstDifference Source

findFirstDifference :: forall obj2 obj1. obj1 -> obj2 -> Maybe Change

Take two raw objects, diff them and return the path to the first difference alongside the type of that difference (changed, deleted, created).

#deepDiffsShouldBeEqual Source

deepDiffsShouldBeEqual :: forall r obj2 obj1. obj1 -> obj2 -> Aff r Unit

Ensure that deep diffs of two JS objects are equal

#deepDiffsShouldNotBeEqual Source

deepDiffsShouldNotBeEqual :: forall r obj2 obj1. obj1 -> obj2 -> Aff r Unit

Ensure that deep diffs of two JS objects are not equal