test_that_json v0.6.0 TestThatJson.Json

Link to this section Summary

Functions

Receives a subject and a value and returns whether they are equal

Receives a subject and a value and returns whether the subject has all keys specified by the value

Receives a subject and a value and returns whether the subject contains only the keys specified by the value

Receives a subject and a value and returns whether the subject contains only the properties (or key value pairs) specified by the value

Receives a subject and a value and returns whether the subject contains only the values specified by the value

Receives a subject and a path and returns whether the path exists within the subject

Receives a subject and a value and returns whether the subject contains the properties (or key value pairs) specified by the value

Receives a subject and an integer and returns with the subject has a size equal to the integer

Receives a subject and a JSON type as an atom and returns whether the subject is that type

Receives a subject and a value and returns whether the subject contains the values specified by the value

Link to this section Types

Link to this type json_array()
json_array() :: String.t() | list()
Link to this type json_number()
json_number() :: String.t() | number()
Link to this type json_object()
json_object() :: String.t() | map()
Link to this type json_string()
json_string() :: String.t()
Link to this type json_value()
json_value() :: json_object() | json_array() | json_string() | json_number()

Link to this section Functions

Link to this function equals?(subject, value)
equals?(json_value(), json_value()) :: boolean()

Receives a subject and a value and returns whether they are equal.

Link to this function has_keys?(subject, value)
has_keys?(json_object(), json_array() | json_string()) :: boolean()

Receives a subject and a value and returns whether the subject has all keys specified by the value.

Link to this function has_only_keys?(subject, value)
has_only_keys?(json_object(), json_array() | json_string()) :: boolean()

Receives a subject and a value and returns whether the subject contains only the keys specified by the value.

Link to this function has_only_properties?(subject, value)
has_only_properties?(json_object(), json_object()) :: boolean()

Receives a subject and a value and returns whether the subject contains only the properties (or key value pairs) specified by the value.

Link to this function has_only_values?(subject, value)
has_only_values?(json_value(), json_value()) :: boolean()

Receives a subject and a value and returns whether the subject contains only the values specified by the value.

Link to this function has_path?(subject, path)
has_path?(json_object() | json_array(), String.t()) :: boolean()

Receives a subject and a path and returns whether the path exists within the subject.

Link to this function has_properties?(subject, value)
has_properties?(json_object(), json_object()) :: boolean()

Receives a subject and a value and returns whether the subject contains the properties (or key value pairs) specified by the value.

Link to this function has_size?(subject, size)
has_size?(json_value(), integer()) :: boolean()

Receives a subject and an integer and returns with the subject has a size equal to the integer.

Link to this function has_type?(subject, type)
has_type?(json_value(), atom()) :: boolean()

Receives a subject and a JSON type as an atom and returns whether the subject is that type.

Valid types: :object, :array, :string, :number, :integer, :float, :boolean, :null.

Link to this function has_values?(subject, value)
has_values?(json_value(), json_value()) :: boolean()

Receives a subject and a value and returns whether the subject contains the values specified by the value.

If the value is a list, returns whether all values in the list are in the subject.

If the value is a JSON array as a String.t, it is not treated the same as a list. Instead, returns whether that list itself is one of the values in the subject.