# Assert

### Overview

The **Assert Component** provides a set of assertion functions for verifying the correctness of component outputs in a test workflow. It checks whether expected conditions are met and outputs success or failure messages accordingly.

### Usage

This component is used to validate component outputs based on defined assertions such as equality checks, presence of values, and regular expression matching.

#### Input Ports

| Port | Description                                         |
| ---- | --------------------------------------------------- |
| `in` | Receives an object containing assertions to verify. |

#### Output Ports

| Port  | Description                                                        |
| ----- | ------------------------------------------------------------------ |
| `out` | Sends the assertion results, including success and error messages. |

#### Properties

| Property     | Type     | Description                                                            |
| ------------ | -------- | ---------------------------------------------------------------------- |
| `expression` | `object` | Defines the assertion logic, including conditions and expected values. |

#### Supported Assertions

| Assertion Type | Description                                                                    |
| -------------- | ------------------------------------------------------------------------------ |
| `equal`        | Checks if a field is equal to an expected value.                               |
| `notEmpty`     | Ensures a field is not empty.                                                  |
| `regex`        | Validates if a field matches a specified regular expression.                   |
| `type`         | Checks if a field is of a specific type (e.g., number, string, array, object). |

#### Processing Logic

1. **Receives Assertions**: Accepts an object defining assertions to be applied.
2. **Validates Conditions**: Runs checks based on assertion type (equality, regex, non-empty values, etc.).
3. **Generates Results**: Produces a success message for each passed assertion and an error message for failures.
4. **Sends Output**: Outputs results as a JSON object with success and error details.

### Notes

* **Multiple Assertions**: Supports multiple assertion checks within a single execution.
* **Flexible Validation**: Works with various data types and assertion conditions.
* **Test Automation**: Useful for validating component outputs in automated testing workflows.

This component is ideal for ensuring data correctness and validating expected behavior in test workflows.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.appmixer.com/connector-configuration/utils/test/assert.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
