arcade_test library
Testing utilities for Arcade framework applications.
This library provides tools for testing Arcade applications including:
- HTTP client for REST API testing
- WebSocket client for real-time communication testing
- State management utilities for testing stateful components
Classes
- ArcadeTestClient
- HTTP client for making test requests to an Arcade test server.
- ArcadeTestServer
- Main test server class for testing Arcade applications.
- ArcadeTestState
- Manages global Arcade state for testing purposes.
- TestResponse
- Wrapper around HTTP response with convenient testing methods.
- TestWebSocket
- A WebSocket client for testing Arcade WebSocket endpoints.
- WebSocketMessage
- Represents a WebSocket message received from the server.
Functions
-
containsJsonKey(
String key) → Matcher - Matches an HTTP response whose JSON body contains the specified key.
-
hasContentType(
String mimeType) → Matcher - Matches an HTTP response with the specified content type.
-
hasEmptyBody(
) → Matcher - Matches an HTTP response with an empty body.
-
hasEvent(
String event) → Matcher - Matches a WebSocket message with the specified event type.
-
hasHeader(
String name, [dynamic value]) → Matcher - Matches an HTTP response that has the specified header.
-
hasJsonBody(
dynamic expected) → Matcher - Matches an HTTP response with the specified JSON body.
-
hasJsonPath(
String path, dynamic expected) → Matcher - Matches an HTTP response with a specific value at the given JSON path.
-
hasMessageData(
dynamic expected) → Matcher - Matches a WebSocket message with the specified data.
-
hasStatus(
int expectedStatus) → Matcher - Custom test matchers for Arcade HTTP responses and WebSocket messages.
-
hasTextBody(
dynamic expected) → Matcher - Matches an HTTP response with the specified text body.
-
isBadRequest(
) → Matcher - Matches an HTTP response with status code 400 (Bad Request).
-
isConflict(
) → Matcher - Matches an HTTP response with status code 409 (Conflict).
-
isCreated(
) → Matcher - Matches an HTTP response with status code 201 (Created).
-
isForbidden(
) → Matcher - Matches an HTTP response with status code 403 (Forbidden).
-
isHtml(
) → Matcher - Matches an HTTP response with HTML content type.
-
isImATeapot(
) → Matcher - Matches an HTTP response with status code 418 (I'm a teapot).
-
isInternalServerError(
) → Matcher - Matches an HTTP response with status code 500 (Internal Server Error).
-
isJson(
) → Matcher - Matches an HTTP response with JSON content type.
-
isMethodNotAllowed(
) → Matcher - Matches an HTTP response with status code 405 (Method Not Allowed).
-
isNoContent(
) → Matcher - Matches an HTTP response with status code 204 (No Content).
-
isNotFound(
) → Matcher - Matches an HTTP response with status code 404 (Not Found).
-
isOk(
) → Matcher - Matches an HTTP response with status code 200 (OK).
-
isServerError(
) → Matcher - Matches an HTTP response with a 5xx server error status code.
- Matches an HTTP response with status code 503 (Service Unavailable).
- Matches an HTTP response with status code 401 (Unauthorized).
-
isUnprocessableEntity(
) → Matcher - Matches an HTTP response with status code 422 (Unprocessable Entity).
Exceptions / Errors
- WebSocketException
- Exception thrown when WebSocket operations fail.