|
1 |
| -import { currentURL, visit } from '@ember/test-helpers'; |
| 1 | +import { currentURL } from '@ember/test-helpers'; |
2 | 2 | import { module, test } from 'qunit';
|
3 | 3 |
|
4 | 4 | import { setupApplicationTest } from 'cargo/tests/helpers';
|
5 | 5 |
|
| 6 | +import { visit } from '../../helpers/visit-ignoring-abort'; |
| 7 | + |
6 | 8 | module('Route | crate.range', function (hooks) {
|
7 | 9 | setupApplicationTest(hooks);
|
8 | 10 |
|
@@ -76,17 +78,18 @@ module('Route | crate.range', function (hooks) {
|
76 | 78 | assert.dom('[data-test-notification-message]').doesNotExist();
|
77 | 79 | });
|
78 | 80 |
|
79 |
| - test('redirects to main crate page if no match found', async function (assert) { |
| 81 | + test('shows an error page if no match found', async function (assert) { |
80 | 82 | let crate = this.server.create('crate', { name: 'foo' });
|
81 | 83 | this.server.create('version', { crate, num: '1.0.0' });
|
82 | 84 | this.server.create('version', { crate, num: '1.1.0' });
|
83 | 85 | this.server.create('version', { crate, num: '1.1.1' });
|
84 | 86 | this.server.create('version', { crate, num: '2.0.0' });
|
85 | 87 |
|
86 | 88 | await visit('/crates/foo/range/^3');
|
87 |
| - assert.equal(currentURL(), `/crates/foo`); |
88 |
| - assert.dom('[data-test-crate-name]').hasText('foo'); |
89 |
| - assert.dom('[data-test-crate-version]').hasText('2.0.0'); |
90 |
| - assert.dom('[data-test-notification-message="error"]').hasText("No matching version of crate 'foo' found for: ^3"); |
| 89 | + assert.equal(currentURL(), '/crates/foo/range/%5E3'); |
| 90 | + assert.dom('[data-test-404-page]').exists(); |
| 91 | + assert.dom('[data-test-title]').hasText('foo: No matching version found for ^3'); |
| 92 | + assert.dom('[data-test-go-back]').exists(); |
| 93 | + assert.dom('[data-test-try-again]').doesNotExist(); |
91 | 94 | });
|
92 | 95 | });
|
0 commit comments