@@ -10,6 +10,9 @@ module('Acceptance | crates page', function(hooks) {
1010 setupApplicationTest ( hooks ) ;
1111 setupMirage ( hooks ) ;
1212
13+ // should match the default set in the crates controller
14+ const per_page = 50 ;
15+
1316 test ( 'is accessible' , async function ( assert ) {
1417 assert . expect ( 0 ) ;
1518
@@ -53,23 +56,29 @@ module('Acceptance | crates page', function(hooks) {
5356 } ) ;
5457
5558 test ( 'listing crates' , async function ( assert ) {
56- this . server . loadFixtures ( ) ;
59+ for ( let i = 1 ; i <= per_page ; i ++ ) {
60+ this . server . create ( 'crate' ) ;
61+ }
5762
5863 await visit ( '/crates' ) ;
5964
60- assert . dom ( '[data-test-crates-nav] [data-test-current-rows]' ) . hasText ( '1-10' ) ;
61- assert . dom ( '[data-test-crates-nav] [data-test-total-rows]' ) . hasText ( '19' ) ;
65+ assert . dom ( '[data-test-crates-nav] [data-test-current-rows]' ) . hasText ( `1- ${ per_page } ` ) ;
66+ assert . dom ( '[data-test-crates-nav] [data-test-total-rows]' ) . hasText ( ` ${ per_page } ` ) ;
6267 } ) ;
6368
6469 test ( 'navigating to next page of crates' , async function ( assert ) {
65- this . server . loadFixtures ( ) ;
70+ for ( let i = 1 ; i <= per_page + 2 ; i ++ ) {
71+ this . server . create ( 'crate' ) ;
72+ }
73+ const page_start = per_page + 1 ;
74+ const total = per_page + 2 ;
6675
6776 await visit ( '/crates' ) ;
6877 await click ( '[data-test-pagination-next]' ) ;
6978
7079 assert . equal ( currentURL ( ) , '/crates?page=2' ) ;
71- assert . dom ( '[data-test-crates-nav] [data-test-current-rows]' ) . hasText ( '11-19' ) ;
72- assert . dom ( '[data-test-crates-nav] [data-test-total-rows]' ) . hasText ( '19' ) ;
80+ assert . dom ( '[data-test-crates-nav] [data-test-current-rows]' ) . hasText ( ` ${ page_start } - ${ total } ` ) ;
81+ assert . dom ( '[data-test-crates-nav] [data-test-total-rows]' ) . hasText ( ` ${ total } ` ) ;
7382 } ) ;
7483
7584 test ( 'crates default sort is alphabetical' , async function ( assert ) {
0 commit comments