# Unified Test Suite For Ably Chat SDKs

Unified Test Suite for Chat SDKs (UTS-Chat) is an executable npm package designed to provide
a consistent testing environment for different Chat SDKs. It streamlines the testing process by abstracting
SDK-specific details into a common interface, allowing you to write tests once and run them across various
SDK implementations.

This Test Suite is based on the UTS for Pub/Sub SDKs, see more detailed description of the underlying features
and components [Pub/Sub UTS repo](https://github.com/ably-labs/unified-test-suite).

## Installation

UTS-Chat can be installed locally or globally using `npm`:

```bash
# Install globally
npm install -g @ably-labs/uts-chat

# Install locally
npm install --save-dev @ably-labs/uts-chat
```

## Usage

To run the test suites using UTS-Chat, you need to specify an environment variable `ADAPTER_EXECUTABLE`,
which points to the command that starts the adapter for your desired SDK.

```bash
# Assuming that `my-java-adapter.jar` is an adapter for ably-java
ADAPTER_EXECUTABLE="java -jar my-java-adapter.jar" uts-chat
```

## Running locally

JS adapter is avaialable locally at [./adapters/js](./adapters/js). You can run UTS Chat tests against it using a single command:

```bash
ADAPTER_EXECUTABLE="npm run start:adapter:js" npm run start
```

or, alternatively, you can launch all UTS components separately for better control and debugging:

```bash
# launch dispatcher first
npm run start:dispatcher

# in a separate console: launch js adapter
npm run start:adapter:js

# in a separate console: launch tests
npm run start:test
```

## Unified SDK client

This Unified Test Suite implements Unified SDK Client for Chat SDK via providing an `RpcChatClient` class for SDK's
core functionality. It can be found in `test/unified-clients` directory.
