Skip to content

[ObjectAssertion] Missing .toHave[Keys|Values|Entries] methods #92

@JoseLion

Description

@JoseLion

The ObjectAssertion class currently has methods for keys, values, and entries that work with a "containing" behavior:

  • .toContainAll[Keys|Values|Entries]: Checks if all the passed values are contained in the keys/values/entries array, but we don't know if a value is missing.
  • .toContainAny[Keys|Values|Entries]: Checks if any of the passed values are contained in the keys/values/entries array. We don't really care if there are extra or missing values.

We are missing methods that work with a "to have exactly" behavior, so we need to implement the following:

  • .toHaveKeys(..): Checks if the object has exactly the provided keys
  • .toHaveValues(..): Checks if the object has exactly the provided values
  • .toHaveEntries(..): Checks if the object has exactly the provided entries. Similar to .toBeEqual(..), but allows an array of entries as arguments instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions