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.

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

  • Dart: 2.0.0-dev.69.0
  • pana: 0.11.7

Platforms

Detected platforms: unsure

Error(s) prevent platform classification:

Error(s) in lib/angular2_testing.dart: Target of URI doesn't exist: 'package:test/test.dart'.

Issues and suggestions

Fix lib/angular2_testing.dart.

Analysis of lib/angular2_testing.dart failed with 7 errors, including:

line 3 col 8: Target of URI doesn't exist: 'package:test/test.dart'.

line 33 col 3: The function 'tearDown' isn't defined.

line 51 col 3: The function 'setUp' isn't defined.

line 53 col 34: The argument type 'Iterable<Provider>' can't be assigned to the parameter type 'List'.

line 95 col 3: The function 'setUp' isn't defined.

Fix platform conflicts.

Error(s) prevent platform classification:

Error(s) in lib/angular2_testing.dart: Target of URI doesn't exist: 'package:test/test.dart'.

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.

Running dartdoc failed.

Make sure dartdoc runs without any issues.

Maintain CHANGELOG.md.

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

Package is too old.

The package was released more than two years ago.

Package is pre-release.

Pre-release versions should be used with caution, their API may change in breaking ways.

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 angular2_testing.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.10.0 <2.0.0
angular2 2.0.0-beta.17 2.0.0-beta.17 3.1.0+1
Transitive dependencies
analyzer 0.27.3 0.32.4
args 0.13.7 1.4.4
async 2.0.8
barback 0.15.2+16
build 0.12.7+2
charcode 1.1.2
cli_util 0.0.1+2 0.1.3+2
code_transformers 0.4.2+3 0.5.1+5
collection 1.14.11
convert 1.1.1 2.0.2
crypto 0.9.2+1 2.0.6
csslib 0.13.7+1 0.14.4+1
dart_style 0.2.4 1.1.3
fixnum 0.10.8
func 0.1.1 1.0.0
glob 1.1.7
html 0.12.2+2 0.13.3+2
intl 0.12.7+1 0.15.7
logging 0.11.3+2
matcher 0.12.4
meta 1.1.6
observe 0.13.5 0.15.1
package_config 0.1.5 1.0.5
path 1.6.2
petitparser 1.7.7
plugin 0.1.0 0.2.0+3
pool 1.3.6
protobuf 0.5.1 0.9.0+1
smoke 0.3.6+3
source_maps 0.10.7
source_span 1.4.1
stack_trace 1.9.3
string_scanner 1.0.3
typed_data 1.1.6
utf 0.9.0+5
watcher 0.9.7+10
when 0.2.0
which 0.1.3
yaml 2.1.15
Dev dependencies
quiver ^0.21.4
test ^0.12.6