# test

Learn how to evaluate a CQL condition.

This method evaluates a [CQL query](/reference/cql) as a boolean predicate.

It is essentially a shorthand for calling the [`evaluate`](/reference/sdk/javascript/api/plug/evaluate) method and checking whether the result is strictly equal to `true`.

> **Strict equality**
>
> Any value other than `true` is considered `false`.

## Signature

This method has the following signature:

```ts
croct.test(query: string, options?: EvaluationOptions): Promise<boolean>
```

The return is a `Promise` that resolves to `true` if the query evaluates to `true`, `false` otherwise.

## Example

Here is a basic example of how to use this method:

```ts
croct.test("user's interests includes 'sports'").then(console.log);
```

## Parameters

The following list describes the supported parameters:

- `query`: `string`

  The [CQL query](/reference/cql) to evaluate, with a maximum length of 500 characters.

- `options`: `object` (optional)

  The evaluation options.

  - `timeout`: `number` (optional)

    The maximum fetch time in milliseconds.

    Once reached, the SDK will abort the request and reject the promise with a timeout error.

  - `attributes`: `object` (optional)

    The map of attributes to inject in the evaluation context.

    The attributes can be referenced in audience conditions using the [`context`](/reference/cql/context#evaluation) variable. For example, suppose you pass the following attributes:

    ```json
    {cities: ["New York", "San Francisco"]}
    ```

    You can then reference them in queries like:

    ```cql
    context's cities include location's cityName
    ```

    For more information, see [Context variables](../../content-rendering#context-variables).

    The following restrictions apply to the attributes:

    - Up to 30 entries and 5 levels deep
    - Keys can be either numbers or non-empty strings with a maximum length of 50 characters
    - Values can be null, numbers, booleans, strings (up to 50 characters), or nested maps
    - Nested maps follow the same constraints for keys and values
