Skip to content

Commit 547a1d1

Browse files
committed
tests/acceptance/crates: Migrate from mirage to @crates-io/msw
1 parent 31d2067 commit 547a1d1

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

tests/acceptance/crates-test.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { click, currentURL, visit } from '@ember/test-helpers';
22
import { module, test } from 'qunit';
33

4+
import { loadFixtures } from '@crates-io/msw/fixtures.js';
45
import percySnapshot from '@percy/ember';
56
import a11yAudit from 'ember-a11y-testing/test-support/audit';
67
import { getPageTitle } from 'ember-page-title/test-support';
@@ -10,13 +11,13 @@ import { setupApplicationTest } from 'crates-io/tests/helpers';
1011
import axeConfig from '../axe-config';
1112

1213
module('Acceptance | crates page', function (hooks) {
13-
setupApplicationTest(hooks);
14+
setupApplicationTest(hooks, { msw: true });
1415

1516
// should match the default set in the crates controller
1617
const per_page = 50;
1718

1819
test('visiting the crates page from the front page', async function (assert) {
19-
this.server.loadFixtures();
20+
loadFixtures();
2021

2122
await visit('/');
2223
await click('[data-test-all-crates-link]');
@@ -29,7 +30,7 @@ module('Acceptance | crates page', function (hooks) {
2930
});
3031

3132
test('visiting the crates page directly', async function (assert) {
32-
this.server.loadFixtures();
33+
loadFixtures();
3334

3435
await visit('/crates');
3536
await click('[data-test-all-crates-link]');
@@ -40,8 +41,8 @@ module('Acceptance | crates page', function (hooks) {
4041

4142
test('listing crates', async function (assert) {
4243
for (let i = 1; i <= per_page; i++) {
43-
let crate = this.server.create('crate');
44-
this.server.create('version', { crate });
44+
let crate = this.db.crate.create();
45+
this.db.version.create({ crate });
4546
}
4647

4748
await visit('/crates');
@@ -52,8 +53,8 @@ module('Acceptance | crates page', function (hooks) {
5253

5354
test('navigating to next page of crates', async function (assert) {
5455
for (let i = 1; i <= per_page + 2; i++) {
55-
let crate = this.server.create('crate');
56-
this.server.create('version', { crate });
56+
let crate = this.db.crate.create();
57+
this.db.version.create({ crate });
5758
}
5859
const page_start = per_page + 1;
5960
const total = per_page + 2;
@@ -67,15 +68,15 @@ module('Acceptance | crates page', function (hooks) {
6768
});
6869

6970
test('crates default sort is by recent downloads', async function (assert) {
70-
this.server.loadFixtures();
71+
loadFixtures();
7172

7273
await visit('/crates');
7374

7475
assert.dom('[data-test-crates-sort] [data-test-current-order]').hasText('Recent Downloads');
7576
});
7677

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

8081
await visit('/crates');
8182

@@ -84,7 +85,7 @@ module('Acceptance | crates page', function (hooks) {
8485
});
8586

8687
test('recent downloads appears for each crate on crate list', async function (assert) {
87-
this.server.loadFixtures();
88+
loadFixtures();
8889

8990
await visit('/crates');
9091

0 commit comments

Comments
 (0)