Skip to main content
Version: 15.0

Setting up a routed feature

💡 Tip Lazy loading a feature isn't a requirement in an integration test.

Standalone feature routes​

To set up standalone feature routes for a feature test, specify the featurePath option and add a route to the routes array option that wraps the standalone routes.

Use createFeatureHarness to create a feature testing harness.

import { createFeatureHarness } from '@ngworker/spectacular';
import {
crisisCenterPath,
crisisCenterRoutes,
} from '@tour-of-heroes/crisis-center';

function setup() {
const harness = createFeatureHarness({
featurePath: crisisCenterPath,
routes: [
{ path: crisisCenterPath, loadChildren: () => crisisCenterRoutes },
],
});

return {
harness,
};
}

Routed feature module​

To set up a routed feature for a feature test, specify the featurePath option and add a route to the routes array option that wraps the routed feature module.

Use createFeatureHarness to create a feature testing harness.

import { createFeatureHarness } from '@ngworker/spectacular';
import {
CrisisCenterModule,
crisisCenterPath,
} from '@tour-of-heroes/crisis-center';

function setup() {
const harness = createFeatureHarness({
featurePath: crisisCenterPath,
routes: [
{ path: crisisCenterPath, loadChildren: () => CrisisCenterModule },
],
});

return {
harness,
};
}