# `Ash.Test`
[🔗](https://github.com/ash-project/ash/blob/v3.27.8/lib/ash/test.ex#L5)

Testing helpers for Ash.

# `assert_has_error`

Assert that the given changeset, query, or action input has a matching error.

Use the optional second argument to assert that the errors (all together) are of a specific class.

# `assert_stripped`
*macro* 

A macro for comparing Ash resources while ignoring metadata differences.

## Overview

Ash resources contain metadata fields (`__metadata__` and `__meta__`) that track internal state like
loaded relationships and action history. These fields can cause equality comparisons to fail even
when the actual data is identical. This macro uses `strip_metadata/1` to remove these fields before
comparison.

## Usage

Use when comparing resources that have gone through different processing paths, such as comparing
seeded data with data that has been processed through resource actions.

## Supported Operators

* `==` and `===` - Equality comparison
* `!=` and `!==` - Inequality comparison
* `in` and `not in` - Membership testing

## Examples

    # Compare resources
    assert_stripped user1 == user2
    assert_stripped [user1, user2] === [user3, user4]
    assert_stripped user1 in [user2, user3, user4]
    assert_stripped user1 not in [user2, user3, user4]

# `refute_has_error`

Refute that the given changeset, query, or action input has a matching error.

The `error_class` argument has been deprecated and should not be used.

# `strip_metadata`

Clears the `__metadata__` field and the underlying ecto `__meta__` field

This allows for easier comparison of changeset/query results

---

*Consult [api-reference.md](api-reference.md) for complete listing*
