angular2_testing 2.0.0-beta.17

  • README.md
  • Installing
  • Versions
  • 0

Contains helpers to run unit tests for angular2 components and injectables, backed by the package:test library.

Usage

Update the dev dependencies in your pubspec.yaml to include the angular testing and test packages:

dev_dependencies:
  test: '^0.12.6'
  angular2_testing: any
  

Then in your test files, use angular2_testing helpers in place of setUp and test:

import 'package:test/test.dart';
import 'package:angular2_testing/angular2_testing.dart';

void main() {
  // This must be called at the beginning of your tests.
  initAngularTests();

  // Initialize the injection tokens you will use in your tests.
  setUpProviders(() => [provide(MyToken, useValue: 'my string'), TestService]);

  // You can then get tokens from the injector via ngSetUp and ngTest.
  ngSetUp((TestService testService) {
    testService.initialize();
  });

  ngTest('can grab injected values', (@Inject(MyToken) token, TestService testService) {
    expect(token, equals('my string'));
    expect(testService.status, equals('ready'));
  });
}

Examples

A sample test is available in test/angular2_testing_test.dart.

Use this package as a library

1. Depend on it

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


dependencies:
  angular2_testing: ^2.0.0-beta.17

2. Install it

You can install packages from the command line:

with pub:


$ pub get

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

3. Import it

Now in your Dart code, you can use:


import 'package:angular2_testing/angular2_testing.dart';
  
Version Uploaded Documentation Archive
2.0.0-beta.17 Apr 28, 2016 Go to the documentation of angular2_testing 2.0.0-beta.17 Download angular2_testing 2.0.0-beta.17 archive
2.0.0-beta.16 Apr 26, 2016 Go to the documentation of angular2_testing 2.0.0-beta.16 Download angular2_testing 2.0.0-beta.16 archive
2.0.0-beta.15 Apr 13, 2016 Go to the documentation of angular2_testing 2.0.0-beta.15 Download angular2_testing 2.0.0-beta.15 archive
2.0.0-beta.14 Apr 7, 2016 Go to the documentation of angular2_testing 2.0.0-beta.14 Download angular2_testing 2.0.0-beta.14 archive
2.0.0-beta.13 Mar 31, 2016 Go to the documentation of angular2_testing 2.0.0-beta.13 Download angular2_testing 2.0.0-beta.13 archive
2.0.0-beta.12 Mar 24, 2016 Go to the documentation of angular2_testing 2.0.0-beta.12 Download angular2_testing 2.0.0-beta.12 archive
2.0.0-beta.11 Mar 18, 2016 Go to the documentation of angular2_testing 2.0.0-beta.11 Download angular2_testing 2.0.0-beta.11 archive
2.0.0-beta.10 Mar 17, 2016 Go to the documentation of angular2_testing 2.0.0-beta.10 Download angular2_testing 2.0.0-beta.10 archive
2.0.0-beta.9 Mar 9, 2016 Go to the documentation of angular2_testing 2.0.0-beta.9 Download angular2_testing 2.0.0-beta.9 archive
2.0.0-beta.8 Mar 2, 2016 Go to the documentation of angular2_testing 2.0.0-beta.8 Download angular2_testing 2.0.0-beta.8 archive

All 25 versions...

Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
0
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
0
Overall:
Weighted score of the above. [more]
0
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://www.dartlang.org/dart-2#migration.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.10.0 <2.0.0