Skip to content

Commit 4a9c17b

Browse files
committed
Use the new ember-cli-mirage setup.
1 parent eb5965f commit 4a9c17b

File tree

8 files changed

+85
-69
lines changed

8 files changed

+85
-69
lines changed

tests/acceptance/categories-test.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,18 @@ import { setupApplicationTest } from 'ember-qunit';
33
import { visit } from '@ember/test-helpers';
44
import a11yAudit from 'ember-a11y-testing/test-support/audit';
55
import axeConfig from '../axe-config';
6+
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
67

78
module('Acceptance | categories', function(hooks) {
89
setupApplicationTest(hooks);
10+
setupMirage(hooks);
911

1012
test('is accessible', async function(assert) {
1113
assert.expect(0);
1214

13-
server.create('category', { category: 'API bindings', crates_cnt: 0 });
14-
server.create('category', { category: 'Algorithms', crates_cnt: 1 });
15-
server.create('category', { category: 'Asynchronous', crates_cnt: 3910 });
15+
this.server.create('category', { category: 'API bindings', crates_cnt: 0 });
16+
this.server.create('category', { category: 'Algorithms', crates_cnt: 1 });
17+
this.server.create('category', { category: 'Asynchronous', crates_cnt: 3910 });
1618

1719
await visit('/categories');
1820
await a11yAudit(axeConfig);
@@ -21,16 +23,16 @@ module('Acceptance | categories', function(hooks) {
2123
test('category/:category_id is accessible', async function(assert) {
2224
assert.expect(0);
2325

24-
server.create('category', { category: 'Algorithms', crates_cnt: 1 });
26+
this.server.create('category', { category: 'Algorithms', crates_cnt: 1 });
2527

2628
await visit('/categories/algorithms');
2729
await a11yAudit(axeConfig);
2830
});
2931

3032
test('listing categories', async function(assert) {
31-
server.create('category', { category: 'API bindings', crates_cnt: 0 });
32-
server.create('category', { category: 'Algorithms', crates_cnt: 1 });
33-
server.create('category', { category: 'Asynchronous', crates_cnt: 3910 });
33+
this.server.create('category', { category: 'API bindings', crates_cnt: 0 });
34+
this.server.create('category', { category: 'Algorithms', crates_cnt: 1 });
35+
this.server.create('category', { category: 'Asynchronous', crates_cnt: 3910 });
3436

3537
await visit('/categories');
3638

@@ -40,7 +42,7 @@ module('Acceptance | categories', function(hooks) {
4042
});
4143

4244
test('category/:category_id index default sort is recent-downloads', async function(assert) {
43-
server.create('category', { category: 'Algorithms', crates_cnt: 1 });
45+
this.server.create('category', { category: 'Algorithms', crates_cnt: 1 });
4446

4547
await visit('/categories/algorithms');
4648

tests/acceptance/crate-test.js

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,16 @@ import { setupApplicationTest } from 'ember-qunit';
44
import { click, fillIn, currentURL, currentRouteName, visit } from '@ember/test-helpers';
55
import a11yAudit from 'ember-a11y-testing/test-support/audit';
66
import axeConfig from '../axe-config';
7+
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
78

89
module('Acceptance | crate page', function(hooks) {
910
setupApplicationTest(hooks);
11+
setupMirage(hooks);
1012

1113
test('is accessible', async function(assert) {
1214
assert.expect(0);
1315

14-
server.create('crate', 'withVersion', { id: 'nanomsg' });
16+
this.server.create('crate', 'withVersion', { id: 'nanomsg' });
1517

1618
await visit('/');
1719
await a11yAudit(axeConfig);
@@ -20,9 +22,9 @@ module('Acceptance | crate page', function(hooks) {
2022
test('/crates/:crate is accessible', async function(assert) {
2123
assert.expect(0);
2224

23-
server.create('crate', { id: 'nanomsg', max_version: '0.6.1' });
24-
server.create('version', { crate: 'nanomsg', num: '0.6.0' });
25-
server.create('version', { crate: 'nanomsg', num: '0.6.1' });
25+
this.server.create('crate', { id: 'nanomsg', max_version: '0.6.1' });
26+
this.server.create('version', { crate: 'nanomsg', num: '0.6.0' });
27+
this.server.create('version', { crate: 'nanomsg', num: '0.6.1' });
2628

2729
await visit('/crates/nanomsg');
2830
await a11yAudit(axeConfig);
@@ -31,9 +33,9 @@ module('Acceptance | crate page', function(hooks) {
3133
test('/crates/:crate/:version is accessible', async function(assert) {
3234
assert.expect(0);
3335

34-
server.create('crate', { id: 'nanomsg', max_version: '0.6.1' });
35-
server.create('version', { crate: 'nanomsg', num: '0.6.0' });
36-
server.create('version', { crate: 'nanomsg', num: '0.6.1' });
36+
this.server.create('crate', { id: 'nanomsg', max_version: '0.6.1' });
37+
this.server.create('version', { crate: 'nanomsg', num: '0.6.0' });
38+
this.server.create('version', { crate: 'nanomsg', num: '0.6.1' });
3739

3840
await visit('/crates/nanomsg/0.6.0');
3941
await a11yAudit(axeConfig);
@@ -42,14 +44,14 @@ module('Acceptance | crate page', function(hooks) {
4244
test('/crates/:crate/owners is accessible', async function(assert) {
4345
assert.expect(0);
4446

45-
server.loadFixtures();
47+
this.server.loadFixtures();
4648

4749
await visit('/crates/nanomsg/owners');
4850
await a11yAudit(axeConfig);
4951
});
5052

5153
test('visiting a crate page from the front page', async function(assert) {
52-
server.create('crate', 'withVersion', { id: 'nanomsg' });
54+
this.server.create('crate', 'withVersion', { id: 'nanomsg' });
5355

5456
await visit('/');
5557
await click('[data-test-just-updated] [data-test-crate-link="0"]');
@@ -59,9 +61,9 @@ module('Acceptance | crate page', function(hooks) {
5961
});
6062

6163
test('visiting /crates/nanomsg', async function(assert) {
62-
server.create('crate', { id: 'nanomsg', max_version: '0.6.1' });
63-
server.create('version', { crate: 'nanomsg', num: '0.6.0' });
64-
server.create('version', { crate: 'nanomsg', num: '0.6.1' });
64+
this.server.create('crate', { id: 'nanomsg', max_version: '0.6.1' });
65+
this.server.create('version', { crate: 'nanomsg', num: '0.6.0' });
66+
this.server.create('version', { crate: 'nanomsg', num: '0.6.1' });
6567

6668
await visit('/crates/nanomsg');
6769

@@ -74,9 +76,9 @@ module('Acceptance | crate page', function(hooks) {
7476
});
7577

7678
test('visiting /crates/nanomsg/', async function(assert) {
77-
server.create('crate', { id: 'nanomsg', max_version: '0.6.1' });
78-
server.create('version', { crate: 'nanomsg', num: '0.6.0' });
79-
server.create('version', { crate: 'nanomsg', num: '0.6.1' });
79+
this.server.create('crate', { id: 'nanomsg', max_version: '0.6.1' });
80+
this.server.create('version', { crate: 'nanomsg', num: '0.6.0' });
81+
this.server.create('version', { crate: 'nanomsg', num: '0.6.1' });
8082

8183
await visit('/crates/nanomsg/');
8284

@@ -89,9 +91,9 @@ module('Acceptance | crate page', function(hooks) {
8991
});
9092

9193
test('visiting /crates/nanomsg/0.6.0', async function(assert) {
92-
server.create('crate', { id: 'nanomsg', max_version: '0.6.1' });
93-
server.create('version', { crate: 'nanomsg', num: '0.6.0' });
94-
server.create('version', { crate: 'nanomsg', num: '0.6.1' });
94+
this.server.create('crate', { id: 'nanomsg', max_version: '0.6.1' });
95+
this.server.create('version', { crate: 'nanomsg', num: '0.6.0' });
96+
this.server.create('version', { crate: 'nanomsg', num: '0.6.1' });
9597

9698
await visit('/crates/nanomsg/0.6.0');
9799

@@ -104,7 +106,7 @@ module('Acceptance | crate page', function(hooks) {
104106
});
105107

106108
test('navigating to the all versions page', async function(assert) {
107-
server.loadFixtures();
109+
this.server.loadFixtures();
108110

109111
await visit('/crates/nanomsg');
110112
await click('[data-test-all-versions-link]');
@@ -113,7 +115,7 @@ module('Acceptance | crate page', function(hooks) {
113115
});
114116

115117
test('navigating to the reverse dependencies page', async function(assert) {
116-
server.loadFixtures();
118+
this.server.loadFixtures();
117119

118120
await visit('/crates/nanomsg');
119121
await click('[data-test-reverse-deps-link]');
@@ -123,7 +125,7 @@ module('Acceptance | crate page', function(hooks) {
123125
});
124126

125127
test('navigating to a user page', async function(assert) {
126-
server.loadFixtures();
128+
this.server.loadFixtures();
127129

128130
await visit('/crates/nanomsg');
129131
await click('[data-test-owners] [data-test-user-link="blabaere"]');
@@ -133,7 +135,7 @@ module('Acceptance | crate page', function(hooks) {
133135
});
134136

135137
test('navigating to a team page', async function(assert) {
136-
server.loadFixtures();
138+
this.server.loadFixtures();
137139

138140
await visit('/crates/nanomsg');
139141
await click('[data-test-owners] [data-test-team-link="github:org:thehydroimpulse"]');
@@ -143,7 +145,7 @@ module('Acceptance | crate page', function(hooks) {
143145
});
144146

145147
test('crates having user-owners', async function(assert) {
146-
server.loadFixtures();
148+
this.server.loadFixtures();
147149

148150
await visit('/crates/nanomsg');
149151

@@ -154,7 +156,7 @@ module('Acceptance | crate page', function(hooks) {
154156
});
155157

156158
test('crates having team-owners', async function(assert) {
157-
server.loadFixtures();
159+
this.server.loadFixtures();
158160

159161
await visit('/crates/nanomsg');
160162

@@ -163,7 +165,7 @@ module('Acceptance | crate page', function(hooks) {
163165
});
164166

165167
test('crates license is supplied by version', async function(assert) {
166-
server.loadFixtures();
168+
this.server.loadFixtures();
167169

168170
await visit('/crates/nanomsg');
169171
assert.dom('[data-test-license]').hasText('Apache-2.0');
@@ -173,15 +175,15 @@ module('Acceptance | crate page', function(hooks) {
173175
});
174176

175177
test('navigating to the owners page when not logged in', async function(assert) {
176-
server.loadFixtures();
178+
this.server.loadFixtures();
177179

178180
await visit('/crates/nanomsg');
179181

180182
assert.dom('#crate-owners p a').doesNotExist();
181183
});
182184

183185
test('navigating to the owners page when not an owner', async function(assert) {
184-
server.loadFixtures();
186+
this.server.loadFixtures();
185187

186188
this.owner.register('service:session', Service.extend({
187189
currentUser: {
@@ -196,7 +198,7 @@ module('Acceptance | crate page', function(hooks) {
196198
});
197199

198200
test('navigating to the owners page', async function(assert) {
199-
server.loadFixtures();
201+
this.server.loadFixtures();
200202

201203
this.owner.register('service:session', Service.extend({
202204
currentUser: {
@@ -212,7 +214,7 @@ module('Acceptance | crate page', function(hooks) {
212214
});
213215

214216
test('listing crate owners', async function(assert) {
215-
server.loadFixtures();
217+
this.server.loadFixtures();
216218

217219
await visit('/crates/nanomsg/owners');
218220

@@ -222,7 +224,7 @@ module('Acceptance | crate page', function(hooks) {
222224
});
223225

224226
test('attempting to add owner without username', async function(assert) {
225-
server.loadFixtures();
227+
this.server.loadFixtures();
226228

227229
await visit('/crates/nanomsg/owners');
228230
await click('#add-owner');
@@ -233,7 +235,7 @@ module('Acceptance | crate page', function(hooks) {
233235
});
234236

235237
test('attempting to add non-existent owner', async function(assert) {
236-
server.loadFixtures();
238+
this.server.loadFixtures();
237239

238240
await visit('/crates/nanomsg/owners');
239241
await fillIn('input[name="username"]', 'spookyghostboo');
@@ -245,7 +247,7 @@ module('Acceptance | crate page', function(hooks) {
245247
});
246248

247249
test('add a new owner', async function(assert) {
248-
server.loadFixtures();
250+
this.server.loadFixtures();
249251

250252
await visit('/crates/nanomsg/owners');
251253
await fillIn('input[name="username"]', 'iain8');
@@ -257,7 +259,7 @@ module('Acceptance | crate page', function(hooks) {
257259
});
258260

259261
test('remove a crate owner', async function(assert) {
260-
server.loadFixtures();
262+
this.server.loadFixtures();
261263

262264
await visit('/crates/nanomsg/owners');
263265
await click('.owners .row:first-child .remove-owner');

tests/acceptance/crates-test.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@ import { setupApplicationTest } from 'ember-qunit';
33
import { click, currentURL, visit } from '@ember/test-helpers';
44
import a11yAudit from 'ember-a11y-testing/test-support/audit';
55
import axeConfig from '../axe-config';
6+
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
67

78
module('Acceptance | crates page', function(hooks) {
89
setupApplicationTest(hooks);
10+
setupMirage(hooks);
911

1012
test('is accessible', async function(assert) {
1113
assert.expect(0);
1214

13-
server.loadFixtures();
15+
this.server.loadFixtures();
1416

1517
await visit('/');
1618
await a11yAudit(axeConfig);
@@ -19,14 +21,14 @@ module('Acceptance | crates page', function(hooks) {
1921
test('/crates is accessible', async function(assert) {
2022
assert.expect(0);
2123

22-
server.loadFixtures();
24+
this.server.loadFixtures();
2325

2426
await visit('/crates');
2527
await a11yAudit(axeConfig);
2628
});
2729

2830
test('visiting the crates page from the front page', async function(assert) {
29-
server.loadFixtures();
31+
this.server.loadFixtures();
3032

3133
await visit('/');
3234
await click('[data-test-all-crates-link]');
@@ -36,7 +38,7 @@ module('Acceptance | crates page', function(hooks) {
3638
});
3739

3840
test('visiting the crates page directly', async function(assert) {
39-
server.loadFixtures();
41+
this.server.loadFixtures();
4042

4143
await visit('/crates');
4244
await click('[data-test-all-crates-link]');
@@ -46,7 +48,7 @@ module('Acceptance | crates page', function(hooks) {
4648
});
4749

4850
test('listing crates', async function(assert) {
49-
server.loadFixtures();
51+
this.server.loadFixtures();
5052

5153
await visit('/crates');
5254

@@ -55,7 +57,7 @@ module('Acceptance | crates page', function(hooks) {
5557
});
5658

5759
test('navigating to next page of crates', async function(assert) {
58-
server.loadFixtures();
60+
this.server.loadFixtures();
5961

6062
await visit('/crates');
6163
await click('[data-test-pagination-next]');
@@ -66,22 +68,22 @@ module('Acceptance | crates page', function(hooks) {
6668
});
6769

6870
test('crates default sort is alphabetical', async function(assert) {
69-
server.loadFixtures();
71+
this.server.loadFixtures();
7072

7173
await visit('/crates');
7274

7375
assert.dom('[data-test-crates-sort] [data-test-current-order]').hasText('Alphabetical');
7476
});
7577

7678
test('downloads appears for each crate on crate list', async function(assert) {
77-
server.loadFixtures();
79+
this.server.loadFixtures();
7880

7981
await visit('/crates');
8082
assert.dom('[data-test-crate-row="0"] [data-test-downloads]').hasText('All-Time: 497');
8183
});
8284

8385
test('recent downloads appears for each crate on crate list', async function(assert) {
84-
server.loadFixtures();
86+
this.server.loadFixtures();
8587

8688
await visit('/crates');
8789
assert.dom('[data-test-crate-row="0"] [data-test-recent-downloads]').hasText('Recent: 497');

0 commit comments

Comments
 (0)