File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ export default Route.extend({
12
12
this . flashMessages . queue ( `Keyword '${ keyword_id } ' does not exist` ) ;
13
13
return this . replaceWith ( 'index' ) ;
14
14
}
15
+
16
+ throw e ;
15
17
}
16
18
} ,
17
19
} ) ;
Original file line number Diff line number Diff line change
1
+ import { currentURL } from '@ember/test-helpers' ;
2
+ import { setupApplicationTest } from 'ember-qunit' ;
3
+ import { module , test } from 'qunit' ;
4
+
5
+ import setupMirage from '../helpers/setup-mirage' ;
6
+ import { visit } from '../helpers/visit-ignoring-abort' ;
7
+
8
+ module ( 'Route | keyword' , function ( hooks ) {
9
+ setupApplicationTest ( hooks ) ;
10
+ setupMirage ( hooks ) ;
11
+
12
+ test ( "shows an error message if the keyword can't be found" , async function ( assert ) {
13
+ await visit ( '/keywords/unknown' ) ;
14
+ assert . equal ( currentURL ( ) , '/' ) ;
15
+ assert . dom ( '[data-test-flash-message]' ) . hasText ( "Keyword 'unknown' does not exist" ) ;
16
+ } ) ;
17
+
18
+ test ( 'server error causes the error page to be shown' , async function ( assert ) {
19
+ this . server . get ( '/api/v1/keywords/:keywordId' , { } , 500 ) ;
20
+
21
+ await visit ( '/keywords/error' ) ;
22
+ assert . equal ( currentURL ( ) , '/keywords/error' ) ;
23
+ assert . dom ( '[data-test-error-message]' ) . includesText ( 'GET /api/v1/keywords/error returned a 500' ) ;
24
+ } ) ;
25
+ } ) ;
You can’t perform that action at this time.
0 commit comments