Skip to content

Commit

Permalink
chore(tests): adapt changes
Browse files Browse the repository at this point in the history
  • Loading branch information
bigopon committed Apr 13, 2019
1 parent ae7f540 commit 9e37699
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
9 changes: 9 additions & 0 deletions test/app-router.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ describe('app-router', () => {
router
._dequeueInstruction()
.then(result => {
if (!result) {
throw new Error('Invalid instruction processing');
}
expect(result.completed).toBe(true);
expect(result.status).toBe('completed');
expect(result.output).toBe(output);
Expand Down Expand Up @@ -184,6 +187,9 @@ describe('app-router', () => {

router._dequeueInstruction()
.then(result => {
if (!result) {
throw new Error('Invalid instruction processing');
}
expect(result.completed).toBe(false);
expect(result.status).toBe('canceled');
expect(result.output).toBe(output);
Expand Down Expand Up @@ -212,6 +218,9 @@ describe('app-router', () => {

router._dequeueInstruction()
.then(result => {
if (!result) {
throw new Error('Invalid instruction processing');
}
expect(result.completed).toBe(false);
expect(result.status).toBe('rejected');
expect(result.output).toBe(output);
Expand Down
12 changes: 6 additions & 6 deletions test/pipeline.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ describe('Pipeline', function() {
// { status, output, completed: status === pipelineStatus.completed }
it('runs to "completed" when there is no step', async () => {
let result = await pipeline.run(navInstruction);
expect(result.status).toBe(PipelineStatus.completed);
expect(result.status).toBe(PipelineStatus.Completed);
expect(result.completed).toBe(true);
});

Expand All @@ -108,7 +108,7 @@ describe('Pipeline', function() {
pipeline.addStep(step);
const result = await pipeline.run(navInstruction);
expect(navInstruction.fragment).toBe(fragment);
expect(result.status).toBe(PipelineStatus.completed);
expect(result.status).toBe(PipelineStatus.Completed);
expect(result.completed).toBe(true);
});

Expand Down Expand Up @@ -144,7 +144,7 @@ describe('Pipeline', function() {
expect(firstCalled).toBe(1);
expect(secondCalled).toBe(1);
expect(thirdCalled).toBe(0);
expect(result.status).toBe(PipelineStatus.rejected);
expect(result.status).toBe(PipelineStatus.Rejected);
});

it('completes with "rejected" status when a step invokes reject()', async () => {
Expand Down Expand Up @@ -178,7 +178,7 @@ describe('Pipeline', function() {
expect(firstCalled).toBe(1);
expect(secondCalled).toBe(1);
expect(thirdCalled).toBe(0);
expect(result.status).toBe(PipelineStatus.rejected);
expect(result.status).toBe(PipelineStatus.Rejected);
expect(result.output.toString()).toContain('Invalid abcdef ắếốộ');
});

Expand Down Expand Up @@ -213,7 +213,7 @@ describe('Pipeline', function() {
expect(firstCalled).toBe(1);
expect(secondCalled).toBe(0);
expect(thirdCalled).toBe(0);
expect(result.status).toBe(PipelineStatus.completed);
expect(result.status).toBe(PipelineStatus.Completed);
expect(result.output.toString()).toBe(new Error('Valid ắếốộắếốộắếốộ').toString());
});

Expand Down Expand Up @@ -248,7 +248,7 @@ describe('Pipeline', function() {
expect(firstCalled).toBe(1);
expect(secondCalled).toBe(0);
expect(thirdCalled).toBe(0);
expect(result.status).toBe(PipelineStatus.canceled);
expect(result.status).toBe(PipelineStatus.Canceled);
expect(result.output.toString()).toBe(new Error('Valid ắếốộắếốộắếốộ').toString());
});
});
Expand Down
2 changes: 1 addition & 1 deletion test/route-loading/load-route-step.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('RouteLoading -- LoadRouteStep', function() {

it('without RouteLoader implementation -- wrapped in Promise', async () => {
const result: PipelineResult = await loadRouteStep.run(navInstruction, next);
expect(result.status).toBe(PipelineStatus.canceled);
expect(result.status).toBe(PipelineStatus.Canceled);
expect(result.output.toString()).toBe(new Error('Route loaders must implement "loadRoute(router, config, navigationInstruction)".').toString());
});
});

0 comments on commit 9e37699

Please sign in to comment.