@@ -19,6 +19,14 @@ module('Acceptance | Dashboard', function (hooks) {
19
19
} ) ;
20
20
21
21
test ( 'shows the dashboard when logged in' , async function ( assert ) {
22
+ let user = this . server . create ( 'user' , {
23
+ login : 'johnnydee' ,
24
+ name : 'John Doe' ,
25
+
26
+ avatar : 'https://avatars2.githubusercontent.com/u/1234567?v=4' ,
27
+ } ) ;
28
+
29
+ this . server . create ( 'mirage-session' , { user } ) ;
22
30
window . localStorage . setItem ( 'isLoggedIn' , '1' ) ;
23
31
24
32
{
@@ -32,23 +40,6 @@ module('Acceptance | Dashboard', function (hooks) {
32
40
this . server . create ( 'version' , { crate, num : '0.1.0' } ) ;
33
41
}
34
42
35
- this . server . get ( '/api/v1/me' , {
36
- user : {
37
- id : 42 ,
38
- login : 'johnnydee' ,
39
- email_verified : true ,
40
- email_verification_sent : true ,
41
- name : 'John Doe' ,
42
-
43
- avatar : 'https://avatars2.githubusercontent.com/u/1234567?v=4' ,
44
- url : 'https://github.com/johnnydee' ,
45
- } ,
46
- owned_crates : [
47
- { id : 123 , name : 'foo-bar' , email_notifications : true } ,
48
- { id : 56456 , name : 'barrrrr' , email_notifications : false } ,
49
- ] ,
50
- } ) ;
51
-
52
43
this . server . get ( '/api/v1/me/updates' , {
53
44
versions : [
54
45
{
@@ -145,7 +136,7 @@ module('Acceptance | Dashboard', function (hooks) {
145
136
meta : { more : true } ,
146
137
} ) ;
147
138
148
- this . server . get ( ' /api/v1/users/42 /stats' , { total_downloads : 3892 } ) ;
139
+ this . server . get ( ` /api/v1/users/${ user . id } /stats` , { total_downloads : 3892 } ) ;
149
140
150
141
await visit ( '/dashboard' ) ;
151
142
assert . equal ( currentURL ( ) , '/dashboard' ) ;
0 commit comments