@@ -9,17 +9,17 @@ import { setupApplicationTest } from 'crates-io/tests/helpers';
99import axeConfig from '../axe-config' ;
1010
1111module ( 'Acceptance | categories' , function ( hooks ) {
12- setupApplicationTest ( hooks ) ;
12+ setupApplicationTest ( hooks , { msw : true } ) ;
1313
1414 test ( 'listing categories' , async function ( assert ) {
1515 this . owner . lookup ( 'service:intl' ) . locale = 'en' ;
1616
17- this . server . create ( 'category' , { category : 'API bindings' } ) ;
18- this . server . create ( 'category' , { category : 'Algorithms' } ) ;
19- this . server . createList ( ' crate' , 1 , { categoryIds : [ 'algorithms' ] } ) ;
20- this . server . create ( 'category' , { category : 'Asynchronous' } ) ;
21- this . server . createList ( 'crate' , 15 , { categoryIds : [ 'asynchronous' ] } ) ;
22- this . server . create ( 'category' , { category : 'Everything' , crates_cnt : 1234 } ) ;
17+ this . db . category . create ( { category : 'API bindings' } ) ;
18+ let algos = this . db . category . create ( { category : 'Algorithms' } ) ;
19+ this . db . crate . create ( { categories : [ algos ] } ) ;
20+ let async = this . db . category . create ( { category : 'Asynchronous' } ) ;
21+ Array . from ( { length : 15 } , ( ) => this . db . crate . create ( { categories : [ async ] } ) ) ;
22+ this . db . category . create ( { category : 'Everything' , crates_cnt : 1234 } ) ;
2323
2424 await visit ( '/categories' ) ;
2525
@@ -35,14 +35,14 @@ module('Acceptance | categories', function (hooks) {
3535 test ( 'listing categories (locale: de)' , async function ( assert ) {
3636 this . owner . lookup ( 'service:intl' ) . locale = 'de' ;
3737
38- this . server . create ( 'category' , { category : 'Everything' , crates_cnt : 1234 } ) ;
38+ this . db . category . create ( { category : 'Everything' , crates_cnt : 1234 } ) ;
3939
4040 await visit ( '/categories' ) ;
4141 assert . dom ( '[data-test-category="everything"] [data-test-crate-count]' ) . hasText ( '1.234 crates' ) ;
4242 } ) ;
4343
4444 test ( 'category/:category_id index default sort is recent-downloads' , async function ( assert ) {
45- this . server . create ( 'category' , { category : 'Algorithms' } ) ;
45+ this . db . category . create ( { category : 'Algorithms' } ) ;
4646
4747 await visit ( '/categories/algorithms' ) ;
4848
@@ -53,8 +53,8 @@ module('Acceptance | categories', function (hooks) {
5353 } ) ;
5454
5555 test ( 'listing category slugs' , async function ( assert ) {
56- this . server . create ( 'category' , { category : 'Algorithms' , description : 'Crates for algorithms' } ) ;
57- this . server . create ( 'category' , { category : 'Asynchronous' , description : 'Async crates' } ) ;
56+ this . db . category . create ( { category : 'Algorithms' , description : 'Crates for algorithms' } ) ;
57+ this . db . category . create ( { category : 'Asynchronous' , description : 'Async crates' } ) ;
5858
5959 await visit ( '/category_slugs' ) ;
6060
0 commit comments