chore(test): migrate Dart tests to package:test

Instead of running with karma and the karma-dart shim, run dart
tests directly using the new package:test runner. This migrates
away from package:unittest.

Fixes a couple tests, mostly associated with depending on absolute
URLs or editing the test providers after an injector had already
been created.

Remove karma-dart and associated files. Change gupfiles to run tests
via `pub run test` instead.
This commit is contained in:
Julie Ralph
2016-02-10 16:54:32 -08:00
parent 7455b907d1
commit 5a59e44765
39 changed files with 532 additions and 511 deletions

View File

@ -4,25 +4,34 @@ import {
describeWith,
describeWithout,
describeWithAndWithout,
itShouldRoute
itShouldRoute,
TEST_ROUTER_PROVIDERS
} from './util';
import {beforeEachProviders, describe} from 'angular2/testing_internal';
import {registerSpecs} from './impl/async_route_spec_impl';
export function main() {
registerSpecs();
describe('async route spec', () => {
describeRouter('async routes', () => {
describeWithout('children', () => {
describeWith('route data', itShouldRoute);
describeWithAndWithout('params', itShouldRoute);
});
beforeEachProviders(() => TEST_ROUTER_PROVIDERS);
describeWith('sync children',
() => { describeWithAndWithout('default routes', itShouldRoute); });
registerSpecs();
describeWith('async children', () => {
describeWithAndWithout('params', () => { describeWithout('default routes', itShouldRoute); });
describeRouter('async routes', () => {
describeWithout('children', () => {
describeWith('route data', itShouldRoute);
describeWithAndWithout('params', itShouldRoute);
});
describeWith('sync children',
() => { describeWithAndWithout('default routes', itShouldRoute); });
describeWith('async children', () => {
describeWithAndWithout('params',
() => { describeWithout('default routes', itShouldRoute); });
});
});
});
}

View File

@ -4,16 +4,27 @@ import {
describeWith,
describeWithout,
describeWithAndWithout,
itShouldRoute
itShouldRoute,
TEST_ROUTER_PROVIDERS
} from './util';
import {
beforeEachProviders,
describe,
} from 'angular2/testing_internal';
import {registerSpecs} from './impl/aux_route_spec_impl';
export function main() {
registerSpecs();
describe('auxiliary route spec', () => {
describeRouter('aux routes', () => {
itShouldRoute();
describeWith('a primary route', itShouldRoute);
beforeEachProviders(() => TEST_ROUTER_PROVIDERS);
registerSpecs();
describeRouter('aux routes', () => {
itShouldRoute();
describeWith('a primary route', itShouldRoute);
});
});
}

View File

@ -238,7 +238,9 @@ export function main() {
async.done();
});
router.navigateByUrl('/rainbow(pony)');
// TODO(juliemr): This isn't necessary for the test to pass - figure
// out what's going on.
// router.navigateByUrl('/rainbow(pony)');
});
}));
});

View File

@ -26,7 +26,7 @@ import {
Redirect
} from 'angular2/src/router/route_config/route_config_decorator';
import {specs, compile, TEST_ROUTER_PROVIDERS, clickOnElement, getHref} from '../util';
import {specs, compile, clickOnElement, getHref} from '../util';
import {BaseException} from 'angular2/src/facade/exceptions';
function getLinkElement(rtc: ComponentFixture, linkIndex: number = 0) {
@ -38,8 +38,6 @@ function auxRoutes() {
var fixture: ComponentFixture;
var rtr;
beforeEachProviders(() => TEST_ROUTER_PROVIDERS);
beforeEach(inject([TestComponentBuilder, Router], (tcBuilder, router) => {
tcb = tcBuilder;
rtr = router;
@ -143,8 +141,6 @@ function auxRoutesWithAPrimaryRoute() {
var fixture: ComponentFixture;
var rtr;
beforeEachProviders(() => TEST_ROUTER_PROVIDERS);
beforeEach(inject([TestComponentBuilder, Router], (tcBuilder, router) => {
tcb = tcBuilder;
rtr = router;

View File

@ -4,23 +4,33 @@ import {
describeWith,
describeWithout,
describeWithAndWithout,
itShouldRoute
itShouldRoute,
TEST_ROUTER_PROVIDERS
} from './util';
import {beforeEachProviders, describe, ddescribe} from 'angular2/testing_internal';
import {registerSpecs} from './impl/sync_route_spec_impl';
export function main() {
registerSpecs();
describe('sync route spec', () => {
describeRouter('sync routes', () => {
describeWithout('children', () => { describeWithAndWithout('params', itShouldRoute); });
beforeEachProviders(() => TEST_ROUTER_PROVIDERS);
describeWith('sync children', () => {
describeWithout('default routes', () => { describeWithAndWithout('params', itShouldRoute); });
describeWith('default routes', () => { describeWithout('params', itShouldRoute); });
registerSpecs();
describeRouter('sync routes', () => {
describeWithout('children', () => { describeWithAndWithout('params', itShouldRoute); });
describeWith('sync children', () => {
describeWithout('default routes',
() => { describeWithAndWithout('params', itShouldRoute); });
describeWith('default routes', () => { describeWithout('params', itShouldRoute); });
});
describeWith('dynamic components', itShouldRoute);
});
describeWith('dynamic components', itShouldRoute);
});
}