liquidart_test library
Testing utilities for Liquidart applications
This library should be imported in test scripts. It should not be imported in application code.
Example:
import 'package:test/test.dart'; import 'package:liquidart/liquidart.dart'; import 'package:liquidart/test.dart';
void main() { test("...", () async => ...); }
Classes
- Agent
- Executes HTTP requests during application testing.
- MockHTTPServer
- This class is used as a 'mock' implementation of another HTTP server.
-
MockServer<
T> - This class is used as a utility for testing.
-
TestHarness<
T extends ApplicationChannel> - Manages application lifecycle for the purpose of testing the application.
-
TestHarnessAuthMixin<
T extends ApplicationChannel> -
Use methods from this class to test applications that use
AuthServer
for authentication & authorization. - TestHarnessORMMixin
- Use methods from this class to test applications that use the Liquidart ORM.
- TestRequest
- Object to construct and execute an HTTP request during testing.
- TestResponse
- An HTTP response from a test application.
- TestResponseBody
- Instances of these type represent the body of a TestResponse.
Constants
-
isBoolean
→ const TypeMatcher<
bool> -
Validates that value is a
bool
. -
isDouble
→ const TypeMatcher<
double> -
Validates that value is a
double
. -
isInteger
→ const TypeMatcher<
int> -
Validates that value is an
int
. - isNotPresent → const Matcher
- Validates that a key is not present when using partial.
-
isNumber
→ const TypeMatcher<
num> -
Validates that value is a
num
. -
isString
→ const TypeMatcher<
String> -
Validates that value is a
String
.
Properties
- isTimestamp ↔ Matcher
-
Validates that a value is a ISO8601 timestamp.
getter/setter pair
Functions
-
expectResponse(
TestResponse response, int statusCode, {dynamic body, Map< String, dynamic> headers = const {}}) → TestResponse -
A convenience for
expect
with hasResponse. -
hasBody(
dynamic bodyMatcher) → Matcher -
Validates that TestResponse has a decoded body that matches
bodyMatcher
. -
hasHeaders(
Map< String, dynamic> headerMatcher, {bool failIfContainsUnmatchedHeader = false}) → Matcher -
Validates that TestResponse has headers that match
headerMatcher
. -
hasResponse(
int? statusCode, {dynamic body, Map< String, dynamic> ? headers, bool failIfContainsUnmatchedHeader = false}) → Matcher -
Validates that TestResponse has matching
statusCode
,body
, andheaders
. -
hasStatus(
int statusCode) → Matcher -
Validates that TestResponse has a status code of
statusCode
. -
isAfter(
DateTime date) → Matcher -
Validates that a DateTime is after
date
. -
isAfterOrSameMomentAs(
DateTime date) → Matcher -
Validates that a DateTime is after or the same moment as
date
. -
isBefore(
DateTime date) → Matcher -
Validates that a DateTime is before
date
. -
isBeforeOrSameMomentAs(
DateTime date) → Matcher -
Validates that a DateTime is before or the same moment as
date
. -
isSameMomentAs(
DateTime date) → Matcher -
Validates that a DateTime is the same moment as
date
. -
partial(
Map< String, dynamic> map) → Matcher - A matcher for maps that only checks the values of the provided keys.