DEV: new API s/replaceCurrentUser/updateCurrentUser

See https://github.com/discourse/discourse/pull/7769
This commit is contained in:
Joffrey JAFFEUX 2019-06-14 10:59:32 +02:00
parent 3a04f95916
commit 8c3fe62e90
4 changed files with 12 additions and 12 deletions

View File

@ -1,4 +1,4 @@
import { acceptance, replaceCurrentUser } from "helpers/qunit-helpers"; import { acceptance, updateCurrentUser } from "helpers/qunit-helpers";
import groupFixtures from "fixtures/group-fixtures"; import groupFixtures from "fixtures/group-fixtures";
acceptance("AdSense", { acceptance("AdSense", {
@ -32,7 +32,7 @@ acceptance("AdSense", {
}); });
test("correct number of ads should show", async assert => { test("correct number of ads should show", async assert => {
replaceCurrentUser({ staff: false, trust_level: 1 }); updateCurrentUser({ staff: false, trust_level: 1 });
await visit("/t/280"); // 20 posts await visit("/t/280"); // 20 posts
const ads = find(".google-adsense.adsense-post-bottom"); const ads = find(".google-adsense.adsense-post-bottom");
assert.equal(ads.length, 3, "it should render 3 ads"); assert.equal(ads.length, 3, "it should render 3 ads");
@ -60,7 +60,7 @@ test("correct number of ads should show", async assert => {
}); });
test("no ads for trust level 3", async assert => { test("no ads for trust level 3", async assert => {
replaceCurrentUser({ staff: false, trust_level: 3 }); updateCurrentUser({ staff: false, trust_level: 3 });
await visit("/t/280"); await visit("/t/280");
assert.equal( assert.equal(
find(".google-adsense.adsense-post-bottom").length, find(".google-adsense.adsense-post-bottom").length,
@ -70,7 +70,7 @@ test("no ads for trust level 3", async assert => {
}); });
test("can omit ads based on groups", async assert => { test("can omit ads based on groups", async assert => {
replaceCurrentUser({ updateCurrentUser({
staff: false, staff: false,
trust_level: 1, trust_level: 1,
groups: [groupFixtures["/groups/discourse.json"].group] groups: [groupFixtures["/groups/discourse.json"].group]

View File

@ -1,4 +1,4 @@
import { acceptance, replaceCurrentUser } from "helpers/qunit-helpers"; import { acceptance, updateCurrentUser } from "helpers/qunit-helpers";
import groupFixtures from "fixtures/group-fixtures"; import groupFixtures from "fixtures/group-fixtures";
acceptance("DFP Ads", { acceptance("DFP Ads", {
@ -32,7 +32,7 @@ acceptance("DFP Ads", {
}); });
test("correct number of ads should show", async assert => { test("correct number of ads should show", async assert => {
replaceCurrentUser({ staff: false, trust_level: 1 }); updateCurrentUser({ staff: false, trust_level: 1 });
await visit("/t/280"); // 20 posts await visit("/t/280"); // 20 posts
const ads = find(".google-dfp-ad.dfp-ad-post-bottom"); const ads = find(".google-dfp-ad.dfp-ad-post-bottom");
assert.equal(ads.length, 3, "it should render 3 ads"); assert.equal(ads.length, 3, "it should render 3 ads");
@ -60,7 +60,7 @@ test("correct number of ads should show", async assert => {
}); });
test("no ads for trust level 3", async assert => { test("no ads for trust level 3", async assert => {
replaceCurrentUser({ staff: false, trust_level: 3 }); updateCurrentUser({ staff: false, trust_level: 3 });
await visit("/t/280"); await visit("/t/280");
assert.equal( assert.equal(
find(".google-dfp-ad.dfp-ad-post-bottom").length, find(".google-dfp-ad.dfp-ad-post-bottom").length,
@ -70,7 +70,7 @@ test("no ads for trust level 3", async assert => {
}); });
test("can omit ads based on groups", async assert => { test("can omit ads based on groups", async assert => {
replaceCurrentUser({ updateCurrentUser({
staff: false, staff: false,
trust_level: 1, trust_level: 1,
groups: [groupFixtures["/groups/discourse.json"].group] groups: [groupFixtures["/groups/discourse.json"].group]

View File

@ -1,4 +1,4 @@
import { acceptance, replaceCurrentUser } from "helpers/qunit-helpers"; import { acceptance, updateCurrentUser } from "helpers/qunit-helpers";
acceptance("House Ads", { acceptance("House Ads", {
loggedIn: true, loggedIn: true,
@ -28,7 +28,7 @@ acceptance("House Ads", {
}); });
test("correct ads show", async assert => { test("correct ads show", async assert => {
replaceCurrentUser({ staff: false, trust_level: 1 }); updateCurrentUser({ staff: false, trust_level: 1 });
await visit("/t/280"); // 20 posts await visit("/t/280"); // 20 posts
assert.equal( assert.equal(

View File

@ -1,4 +1,4 @@
import { acceptance, replaceCurrentUser } from "helpers/qunit-helpers"; import { acceptance, updateCurrentUser } from "helpers/qunit-helpers";
acceptance("Mixed Ads", { acceptance("Mixed Ads", {
loggedIn: true, loggedIn: true,
@ -39,7 +39,7 @@ acceptance("Mixed Ads", {
}); });
test("correct ads show", async assert => { test("correct ads show", async assert => {
replaceCurrentUser({ staff: false, trust_level: 1 }); updateCurrentUser({ staff: false, trust_level: 1 });
await visit("/t/280"); // 20 posts await visit("/t/280"); // 20 posts
const houseAdsCount = find(".house-creative").length; const houseAdsCount = find(".house-creative").length;