Skip to content

Commit ede26c7

Browse files
committed
tests/components/privileged-action: Migrate from mirage to @crates-io/msw
1 parent 62a931a commit ede26c7

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

tests/components/privileged-action-test.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@ import { module, test } from 'qunit';
44
import { hbs } from 'ember-cli-htmlbars';
55

66
import { setupRenderingTest } from 'crates-io/tests/helpers';
7-
8-
import setupMirage from '../helpers/setup-mirage';
7+
import setupMsw from 'crates-io/tests/helpers/setup-msw';
98

109
module('Component | PrivilegedAction', hooks => {
1110
setupRenderingTest(hooks);
12-
setupMirage(hooks);
11+
setupMsw(hooks);
1312

1413
hooks.beforeEach(function () {
1514
// Adds a utility function that renders a PrivilegedAction with all the
@@ -34,7 +33,7 @@ module('Component | PrivilegedAction', hooks => {
3433
});
3534

3635
test('unprivileged block is shown to a logged in user without access', async function (assert) {
37-
const user = this.server.create('user');
36+
const user = this.db.user.create();
3837
this.authenticateAs(user);
3938

4039
await this.renderComponent(false);
@@ -44,7 +43,7 @@ module('Component | PrivilegedAction', hooks => {
4443
});
4544

4645
test('privileged block is shown to a logged in user with access', async function (assert) {
47-
const user = this.server.create('user');
46+
const user = this.db.user.create();
4847
this.authenticateAs(user);
4948

5049
await this.renderComponent(true);
@@ -54,7 +53,7 @@ module('Component | PrivilegedAction', hooks => {
5453
});
5554

5655
test('placeholder block is shown to a logged in admin without sudo', async function (assert) {
57-
const user = this.server.create('user', { isAdmin: true });
56+
const user = this.db.user.create({ isAdmin: true });
5857
this.authenticateAs(user);
5958

6059
const session = this.owner.lookup('service:session');
@@ -69,7 +68,7 @@ module('Component | PrivilegedAction', hooks => {
6968
});
7069

7170
test('privileged block is shown to a logged in admin without sudo with access', async function (assert) {
72-
const user = this.server.create('user', { isAdmin: true });
71+
const user = this.db.user.create({ isAdmin: true });
7372
this.authenticateAs(user);
7473

7574
const session = this.owner.lookup('service:session');
@@ -84,7 +83,7 @@ module('Component | PrivilegedAction', hooks => {
8483
});
8584

8685
test('privileged block is shown to a logged in admin with sudo', async function (assert) {
87-
const user = this.server.create('user', { isAdmin: true });
86+
const user = this.db.user.create({ isAdmin: true });
8887
this.authenticateAs(user);
8988

9089
const session = this.owner.lookup('service:session');
@@ -100,7 +99,7 @@ module('Component | PrivilegedAction', hooks => {
10099
});
101100

102101
test('automatic placeholder block', async function (assert) {
103-
const user = this.server.create('user', { isAdmin: true });
102+
const user = this.db.user.create({ isAdmin: true });
104103
this.authenticateAs(user);
105104

106105
const session = this.owner.lookup('service:session');

0 commit comments

Comments
 (0)