Skip to contents

Named lists in R are ordered, but they translate to unordered objects in JSON. This test expectation loosens the equality check of two objects to ignore the order of elements in a named list.

Usage

expect_json_equivalent(
  object,
  expected,
  info = NULL,
  label = "object",
  expected.label = "expected"
)

Arguments

object

object to test

expected

expected value

info

extra information to be included in the message

label

character name by which to refer to object in the test result. Because the tools for deparsing object names that 'testthat' uses aren't exported from that package, the default here is just "object".

expected.label

character same as label but for expected

Value

Invisibly, returns object for optionally passing to other expectations.