style_test 1.0.0+3 copy "style_test: ^1.0.0+3" to clipboard
style_test: ^1.0.0+3 copied to clipboard

A starting point for Dart libraries or applications.

//TODO: Template

Features #

Tester for Style framework

Getting started #

add latest version "style_test" to dev_dependencies

Usage #

Ensure main is async and await initStyleTester

void main() async {
  await initStyleTester(
      "route",
      MyServer(),
          (tester) async {
        /// test /a/1
        tester("/a/1", bodyIs("1r"));
      });
}

Matchers #

bodyIs(matcherOrValue)

Check body.

matcherOrValue can be matcher instance.

Eg.

tester("/path/to", bodyIs(contains("any")));

statusCodeIs(int)

Check status code.

Eg.

tester("/path/to", statusCodeIs(200));

statusCodeIsInRange(min,max)

Check status code is in range.

Eg.

tester("/path/to", statusCodeIsInRange(200,300)); // max exclude

Simple range matchers:

  • isInformational for informational status codes. (1**).
  • isSuccess for success status codes (2**).
  • isRedirection for redirection status codes. (3**).
  • isClientError for client error status codes. (4**).
  • isServerError for server error status codes. (5**).

headerIs(key, value)

Check headers.

Eg.

tester("/path/to", headerIs("Location","http://localhost/my_user1"));

permissionDenied

tester("/path/to", permissionDenied);

isUnauthorized

tester("/path/to", isUnauthorized);

Additional information #

// TODO: This documentation is a template.

0
likes
150
pub points
0%
popularity

Publisher

verified publisherstyledart.dev

A starting point for Dart libraries or applications.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

meta, style_dart, test

More

Packages that depend on style_test