REFACTOR: Use the new format for acceptance tests. (#97)
This commit is contained in:
parent
4131f8403a
commit
4bf6420b91
|
@ -1,9 +1,9 @@
|
|||
import { acceptance, updateCurrentUser } from "helpers/qunit-helpers";
|
||||
import groupFixtures from "fixtures/group-fixtures";
|
||||
|
||||
acceptance("AdSense", {
|
||||
loggedIn: true,
|
||||
settings: {
|
||||
acceptance("AdSense", function(needs) {
|
||||
needs.user();
|
||||
needs.settings({
|
||||
no_ads_for_groups: "47",
|
||||
no_ads_for_categories: "1",
|
||||
adsense_publisher_code: "MYADSENSEID",
|
||||
|
@ -19,8 +19,8 @@ acceptance("AdSense", {
|
|||
adsense_nth_post_code: 6,
|
||||
adsense_topic_above_post_stream_code: "above_post_stream_ad_unit",
|
||||
adsense_topic_above_post_stream_ad_sizes: "728*90 - leaderboard",
|
||||
},
|
||||
site: {
|
||||
});
|
||||
needs.site({
|
||||
house_creatives: {
|
||||
settings: {
|
||||
topic_list_top: "",
|
||||
|
@ -31,10 +31,9 @@ acceptance("AdSense", {
|
|||
},
|
||||
creatives: {},
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
test("correct number of ads should show", async (assert) => {
|
||||
test("correct number of ads should show", async (assert) => {
|
||||
updateCurrentUser({ staff: false, trust_level: 1 });
|
||||
await visit("/t/280"); // 20 posts
|
||||
|
||||
|
@ -67,9 +66,9 @@ test("correct number of ads should show", async (assert) => {
|
|||
1,
|
||||
"ad after 18th post"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
test("no ads for trust level 3", async (assert) => {
|
||||
test("no ads for trust level 3", async (assert) => {
|
||||
updateCurrentUser({ staff: false, trust_level: 3 });
|
||||
await visit("/t/280");
|
||||
assert.equal(
|
||||
|
@ -77,9 +76,9 @@ test("no ads for trust level 3", async (assert) => {
|
|||
0,
|
||||
"it should render 0 ads"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
test("can omit ads based on groups", async (assert) => {
|
||||
test("can omit ads based on groups", async (assert) => {
|
||||
updateCurrentUser({
|
||||
staff: false,
|
||||
trust_level: 1,
|
||||
|
@ -91,9 +90,9 @@ test("can omit ads based on groups", async (assert) => {
|
|||
0,
|
||||
"it should render 0 ads"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
test("can omit ads based on category", async (assert) => {
|
||||
test("can omit ads based on category", async (assert) => {
|
||||
updateCurrentUser({ staff: false, trust_level: 1 });
|
||||
await visit("/t/28830");
|
||||
assert.equal(
|
||||
|
@ -101,4 +100,5 @@ test("can omit ads based on category", async (assert) => {
|
|||
0,
|
||||
"it should render 0 ads"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { acceptance, updateCurrentUser } from "helpers/qunit-helpers";
|
||||
import groupFixtures from "fixtures/group-fixtures";
|
||||
|
||||
acceptance("DFP Ads", {
|
||||
loggedIn: true,
|
||||
settings: {
|
||||
acceptance("DFP Ads", function(needs) {
|
||||
needs.user();
|
||||
needs.settings({
|
||||
no_ads_for_groups: "47",
|
||||
no_ads_for_categories: "1",
|
||||
dfp_publisher_id: "MYdfpID",
|
||||
|
@ -19,8 +19,8 @@ acceptance("DFP Ads", {
|
|||
dfp_nth_post_code: 6,
|
||||
dfp_topic_above_post_stream_code: "list_top_ad_unit",
|
||||
dfp_topic_above_post_stream_ad_sizes: "728*90 - leaderboard",
|
||||
},
|
||||
site: {
|
||||
});
|
||||
needs.site({
|
||||
house_creatives: {
|
||||
settings: {
|
||||
topic_list_top: "",
|
||||
|
@ -31,10 +31,9 @@ acceptance("DFP Ads", {
|
|||
},
|
||||
creatives: {},
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
test("correct number of ads should show", async (assert) => {
|
||||
test("correct number of ads should show", async (assert) => {
|
||||
updateCurrentUser({ staff: false, trust_level: 1 });
|
||||
await visit("/t/280"); // 20 posts
|
||||
const ads = find(".google-dfp-ad.dfp-ad-post-bottom");
|
||||
|
@ -60,9 +59,9 @@ test("correct number of ads should show", async (assert) => {
|
|||
1,
|
||||
"ad after 18th post"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
test("no ads for trust level 3", async (assert) => {
|
||||
test("no ads for trust level 3", async (assert) => {
|
||||
updateCurrentUser({ staff: false, trust_level: 3 });
|
||||
await visit("/t/280");
|
||||
assert.equal(
|
||||
|
@ -70,9 +69,9 @@ test("no ads for trust level 3", async (assert) => {
|
|||
0,
|
||||
"it should render 0 ads"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
test("can omit ads based on groups", async (assert) => {
|
||||
test("can omit ads based on groups", async (assert) => {
|
||||
updateCurrentUser({
|
||||
staff: false,
|
||||
trust_level: 1,
|
||||
|
@ -84,9 +83,9 @@ test("can omit ads based on groups", async (assert) => {
|
|||
0,
|
||||
"it should render 0 ads"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
test("can omit ads based on category", async (assert) => {
|
||||
test("can omit ads based on category", async (assert) => {
|
||||
updateCurrentUser({ staff: false, trust_level: 1 });
|
||||
await visit("/t/28830");
|
||||
assert.equal(
|
||||
|
@ -94,4 +93,5 @@ test("can omit ads based on category", async (assert) => {
|
|||
0,
|
||||
"it should render 0 ads"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import { acceptance, updateCurrentUser } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("House Ads", {
|
||||
loggedIn: true,
|
||||
settings: {
|
||||
acceptance("House Ads", function (needs) {
|
||||
needs.user();
|
||||
needs.settings({
|
||||
no_ads_for_categories: "1",
|
||||
house_ads_after_nth_post: 6,
|
||||
},
|
||||
site: {
|
||||
});
|
||||
needs.site({
|
||||
house_creatives: {
|
||||
settings: {
|
||||
topic_list_top: "Topic List",
|
||||
|
@ -24,10 +24,9 @@ acceptance("House Ads", {
|
|||
Post: "<div class='h-post'>BELOW POST</div>",
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
test("correct ads show", async (assert) => {
|
||||
test("correct ads show", async (assert) => {
|
||||
updateCurrentUser({ staff: false, trust_level: 1 });
|
||||
await visit("/t/280"); // 20 posts
|
||||
|
||||
|
@ -91,4 +90,5 @@ test("correct ads show", async (assert) => {
|
|||
0,
|
||||
"no ad above category topic list because category is in no_ads_for_categories"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { acceptance, updateCurrentUser } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("Mixed Ads", {
|
||||
loggedIn: true,
|
||||
settings: {
|
||||
acceptance("Mixed Ads", function(needs) {
|
||||
needs.user();
|
||||
needs.settings({
|
||||
house_ads_after_nth_post: 6,
|
||||
house_ads_frequency: 50,
|
||||
dfp_publisher_id: "MYdfpID",
|
||||
|
@ -16,8 +16,8 @@ acceptance("Mixed Ads", {
|
|||
dfp_mobile_post_bottom_code: "mobile_post_bottom_ad_unit",
|
||||
dfp_mobile_post_bottom_ad_size: "300*250 - medium rectangle",
|
||||
dfp_nth_post_code: 6,
|
||||
},
|
||||
site: {
|
||||
});
|
||||
needs.site({
|
||||
house_creatives: {
|
||||
settings: {
|
||||
topic_list_top: "Topic List",
|
||||
|
@ -35,10 +35,9 @@ acceptance("Mixed Ads", {
|
|||
Post: "<div class='h-post'>BELOW POST</div>",
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
test("correct ads show", async (assert) => {
|
||||
test("correct ads show", async (assert) => {
|
||||
updateCurrentUser({ staff: false, trust_level: 1 });
|
||||
await visit("/t/280"); // 20 posts
|
||||
|
||||
|
@ -56,4 +55,5 @@ test("correct ads show", async (assert) => {
|
|||
1,
|
||||
"it should render ad above topic list"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue