angel_test 1.1.0

  • Installing
  • Versions
  • 51


version 1.0.6 build status

Testing utility library for the Angel framework.


The TestClient class is a custom angel_client that sends mock requests to your server. This means that you will not have to bind your server to HTTP to run. Plus, it is an angel_client, and thus supports services and other goodies.

The TestClient also supports WebSockets. WebSockets cannot be mocked (yet!) within this library, so calling the websocket() function will also bind your server to HTTP, if it is not already listening.

The return value is a WebSockets client instance (from package:angel_websocket);

var ws = await client.websocket('/ws');

// To receive all blobs of data sent on the WebSocket:


Several Matchers are bundled with this package, and run on any package:http Response, not just those returned by Angel.

test('foo', () async {
    var res = await client.get('/foo');
    expect(res, allOf([
        isJson({'foo': 'bar'}),
        hasHeader('server'), // Assert header present
        hasHeader('server', 'angel'), // Assert header present with value
        hasHeader('foo', ['bar', 'baz']), // ... Or multiple values
        hasBody(), // Assert non-empty body
        hasBody('{"foo":"bar"}') // Assert specific body

test('error', () async {
    var res = await client.get('/error');
    expect(res, isAngelHttpException());
    expect(res, isAngelHttpException(statusCode: 404, message: ..., errors: [...])) // Optional

hasValidBody is one of the most powerful Matchers in this library, because it allows you to validate a JSON body against a validation schema.

Angel provides a comprehensive validation library that integrates tightly with the very matcher package that you already use for testing. :)

test('validate response', () async {
    var res = await client.get('/bar');
    expect(res, hasValidBody(new Validator({
        'foo': isBoolean,
        'bar': [isString, equals('baz')],
        'age*': [],
        'nested': someNestedValidator

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  angel_test: "^1.1.0"

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

      import 'package:angel_test/angel_test.dart';
Version Uploaded Documentation Archive
1.1.0 Dec 7, 2017 Go to the documentation of angel_test 1.1.0 Download angel_test 1.1.0 archive
1.0.6 Jun 3, 2017 Go to the documentation of angel_test 1.0.6 Download angel_test 1.0.6 archive
1.0.5+1 May 27, 2017 Go to the documentation of angel_test 1.0.5+1 Download angel_test 1.0.5+1 archive
1.0.5 Apr 25, 2017 Go to the documentation of angel_test 1.0.5 Download angel_test 1.0.5 archive
1.0.4 Mar 29, 2017 Go to the documentation of angel_test 1.0.4 Download angel_test 1.0.4 archive
1.0.3 Mar 29, 2017 Go to the documentation of angel_test 1.0.3 Download angel_test 1.0.3 archive
1.0.2 Mar 25, 2017 Go to the documentation of angel_test 1.0.2 Download angel_test 1.0.2 archive
1.0.1 Mar 25, 2017 Go to the documentation of angel_test 1.0.1 Download angel_test 1.0.1 archive
1.0.0 Jan 28, 2017 Go to the documentation of angel_test 1.0.0 Download angel_test 1.0.0 archive
1.1.0-alpha+1 Nov 18, 2017 Go to the documentation of angel_test 1.1.0-alpha+1 Download angel_test 1.1.0-alpha+1 archive

All 13 versions...


We analyzed this package on Jun 19, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.63.0
  • pana: 0.11.3


Describes how popular the package is relative to other packages. [more]
56 / 100
Code health derived from static analysis. [more]
25 / 100
Reflects how tidy and up-to-date the package is. [more]
75 / 100
Overall score:
Weighted score of the above. [more]
Learn more about scoring.


Detected platforms: Flutter, other

Primary library: package:angel_test/angel_test.dart with components: io, isolate.


  • Maintain

    Changelog entries help clients to follow the progress in your code.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 9 errors 23 hints.

    Strong-mode analysis of lib/src/client.dart failed with the following error:

    line: 102 col: 51
    The operator '[]=' isn't defined for the class 'Object'.

    Strong-mode analysis of lib/src/matchers.dart failed with the following error:

    line: 54 col: 3
    Invalid override. The type of '_IsJson.matches' ('(Response, Map<dynamic, dynamic>) → bool') isn't a subtype of 'Matcher.matches' ('(dynamic, Map<dynamic, dynamic>) → bool').

    Similar analysis of the following files failed:

    • lib/angel_test.dart (hint)
  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Maintain an example.

    Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use angel_test.dart.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.19.0
angel_client ^1.1.0-alpha 1.2.0+1
angel_framework ^1.1.0-alpha 1.1.4+3
angel_validate ^1.0.0 1.0.3
angel_websocket ^1.1.0-alpha 1.1.1
http ^0.11.3+9 0.11.3+16
matcher ^0.12.0+2 0.12.3
mock_request ^1.0.0 1.0.3
uuid ^0.5.3 0.5.3 1.0.0
Transitive dependencies
angel_auth 1.1.0+2
angel_http_exception 1.0.0
angel_model 1.0.0
angel_route 2.0.6
async 2.0.7
body_parser 1.1.0
charcode 1.1.1
code_buffer 1.0.0
collection 1.14.10
combinator 1.0.0
container 0.1.2
convert 2.0.1
crypto 2.0.5
dart2_constant 1.0.1+dart2
http_parser 3.1.2
http_server 0.9.7
json_god 2.0.0-beta+1
logging 0.11.3+1
merge_map 1.0.0
meta 1.1.5
mime 0.9.6+1
path 1.6.1
pool 1.3.5
quiver_hashcode 1.0.0
random_string 0.0.1
source_span 1.4.0
stack_trace 1.9.2
stream_channel 1.6.7+1
string_scanner 1.0.2
tuple 1.0.1
typed_data 1.1.5
web_socket_channel 1.0.8
Dev dependencies
test ^0.12.17+2