DEV: Don't await for updateCurrentUser (#17534)

It doesn't return Promises.
This commit is contained in:
Jarek Radosz 2022-07-17 00:21:12 +02:00 committed by GitHub
parent 39c35ee47d
commit 5707431981
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 8 deletions

View File

@ -78,6 +78,7 @@ function preferencesPretender(server, helper) {
acceptance("User Preferences", function (needs) { acceptance("User Preferences", function (needs) {
needs.user(); needs.user();
needs.pretender(preferencesPretender); needs.pretender(preferencesPretender);
test("update some fields", async function (assert) { test("update some fields", async function (assert) {
await visit("/u/eviltrout/preferences"); await visit("/u/eviltrout/preferences");
@ -326,6 +327,7 @@ acceptance(
}); });
} }
); );
acceptance( acceptance(
"Avatar selector when selectable avatars allows staff to upload", "Avatar selector when selectable avatars allows staff to upload",
function (needs) { function (needs) {
@ -341,7 +343,7 @@ acceptance(
}); });
test("allows staff to upload", async function (assert) { test("allows staff to upload", async function (assert) {
await updateCurrentUser({ updateCurrentUser({
trust_level: 3, trust_level: 3,
moderator: true, moderator: true,
admin: false, admin: false,
@ -358,9 +360,10 @@ acceptance(
) )
); );
}); });
test("disallow non-staff", async function (assert) { test("disallow non-staff", async function (assert) {
await visit("/u/eviltrout/preferences"); await visit("/u/eviltrout/preferences");
await updateCurrentUser({ updateCurrentUser({
trust_level: 3, trust_level: 3,
moderator: false, moderator: false,
admin: false, admin: false,
@ -394,7 +397,7 @@ acceptance(
test("with a tl3 user", async function (assert) { test("with a tl3 user", async function (assert) {
await visit("/u/eviltrout/preferences"); await visit("/u/eviltrout/preferences");
await updateCurrentUser({ updateCurrentUser({
trust_level: 3, trust_level: 3,
moderator: false, moderator: false,
admin: false, admin: false,
@ -410,9 +413,10 @@ acceptance(
) )
); );
}); });
test("with a tl2 user", async function (assert) { test("with a tl2 user", async function (assert) {
await visit("/u/eviltrout/preferences"); await visit("/u/eviltrout/preferences");
await updateCurrentUser({ updateCurrentUser({
trust_level: 2, trust_level: 2,
moderator: false, moderator: false,
admin: false, admin: false,
@ -428,9 +432,10 @@ acceptance(
) )
); );
}); });
test("always allow staff to upload", async function (assert) { test("always allow staff to upload", async function (assert) {
await visit("/u/eviltrout/preferences"); await visit("/u/eviltrout/preferences");
await updateCurrentUser({ updateCurrentUser({
trust_level: 2, trust_level: 2,
moderator: true, moderator: true,
admin: false, admin: false,
@ -592,7 +597,7 @@ acceptance("Ignored users", function (needs) {
test("when trust level < min level to ignore", async function (assert) { test("when trust level < min level to ignore", async function (assert) {
await visit(`/u/eviltrout/preferences/users`); await visit(`/u/eviltrout/preferences/users`);
await updateCurrentUser({ trust_level: 0, moderator: false, admin: false }); updateCurrentUser({ trust_level: 0, moderator: false, admin: false });
assert.ok( assert.ok(
!exists(".user-ignore"), !exists(".user-ignore"),
@ -602,13 +607,13 @@ acceptance("Ignored users", function (needs) {
test("when trust level >= min level to ignore", async function (assert) { test("when trust level >= min level to ignore", async function (assert) {
await visit(`/u/eviltrout/preferences/users`); await visit(`/u/eviltrout/preferences/users`);
await updateCurrentUser({ trust_level: 1 }); updateCurrentUser({ trust_level: 1 });
assert.ok(exists(".user-ignore"), "it shows the list of ignored users"); assert.ok(exists(".user-ignore"), "it shows the list of ignored users");
}); });
test("staff can always see ignored users", async function (assert) { test("staff can always see ignored users", async function (assert) {
await visit(`/u/eviltrout/preferences/users`); await visit(`/u/eviltrout/preferences/users`);
await updateCurrentUser({ moderator: true }); updateCurrentUser({ moderator: true });
assert.ok(exists(".user-ignore"), "it shows the list of ignored users"); assert.ok(exists(".user-ignore"), "it shows the list of ignored users");
}); });
}); });