Skip to content
This repository has been archived by the owner on Dec 6, 2017. It is now read-only.

fix(tests): workaround matcher bug #224

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dart --checked test/transformer_test.dart
echo "Building example..."
rm -rf example/build/
cd example
pub_out=$(pub build | tee /dev/tty | grep -F "mirror" || : )
pub_out=$(pub build | tee /dev/tty | grep "mirror" | grep -v "mirrors_remover" || : )
cd ..
echo "--------"

Expand Down
12 changes: 9 additions & 3 deletions test/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
library di.tests;

import 'package:guinness/guinness.dart';
import 'package:matcher/matcher.dart' as matcher;
import 'package:di/di.dart';
import 'package:di/annotations.dart';
import 'package:di/type_literal.dart';
Expand Down Expand Up @@ -788,8 +787,15 @@ createInjectorSpec(String injectorName, ModuleFactory moduleFactory) {
var parent = new ModuleInjector([moduleFactory()..bind(Engine)]);
var child = new ModuleInjector([moduleFactory()..bind(MockEngine)], parent);

expect(parent.types).to(matcher.unorderedEquals([Engine, Injector]));
expect(child.types).to(matcher.unorderedEquals([Engine, MockEngine, Injector]));
void expectUnorderedEquals(actual, expected) {
expect(actual.length).toEqual(expected.length);
expected.forEach((item) {
expect(actual).toContain(item);
});
}

expectUnorderedEquals(parent.types, [Engine, Injector]);
expectUnorderedEquals(child.types, [Engine, MockEngine, Injector]);
});

it('should inject instance from parent if not provided in child', () {
Expand Down