Documentation
    Preparing search index...
    • Validates deep equality between two values using JSON comparison.

      Performs recursive comparison of objects and arrays. Supports an optional exception filter to ignore specific keys during comparison. Useful for validating API responses, data transformations, and object state changes.

      Type Parameters

      • X

        The first value to compare

      • Y = X

      Parameters

      • title: string

        Descriptive title used in error messages when values differ

      • X: X
      • y: Y | null | undefined

        The second value to compare (can be null or undefined)

      • Optionalexception: (key: string) => boolean

        Optional filter function to exclude specific keys from comparison

      Returns void

        // Basic equality
      TestValidator.equals("response should match expected", expectedUser, actualUser);

      // Ignore timestamps in comparison
      TestValidator.equals("user data should match", expectedUser, actualUser,
      (key) => key === "updatedAt"
      );

      // Validate API response structure
      TestValidator.equals("API response structure",
      { id: 1, name: "John" },
      { id: 1, name: "John" }
      );

      // Type-safe nullable comparisons
      const nullableData: { name: string } | null = getData();
      TestValidator.equals("nullable check", nullableData, null);

      Error with detailed diff information when values are not equal