Skip to content

Commit 975ef7b

Browse files
committed
crate.range: Show error page if crate fails to load
1 parent d438a6b commit 975ef7b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/routes/crate/range-test.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,17 @@ module('Route | crate.range', function (hooks) {
8787
assert.dom('[data-test-try-again]').doesNotExist();
8888
});
8989

90+
test('shows an error page if crate fails to load', async function (assert) {
91+
this.server.get('/api/v1/crates/:crate_name', {}, 500);
92+
93+
await visit('/crates/foo/range/^3');
94+
assert.equal(currentURL(), '/crates/foo/range/%5E3');
95+
assert.dom('[data-test-404-page]').exists();
96+
assert.dom('[data-test-title]').hasText('Crate failed to load');
97+
assert.dom('[data-test-go-back]').doesNotExist();
98+
assert.dom('[data-test-try-again]').exists();
99+
});
100+
90101
test('shows an error page if no match found', async function (assert) {
91102
let crate = this.server.create('crate', { name: 'foo' });
92103
this.server.create('version', { crate, num: '1.0.0' });

0 commit comments

Comments
 (0)