REFACTOR: Use the new format for acceptance tests. (#37)

This commit is contained in:
Roman Rizzi
2021-01-04 16:32:33 -03:00
committed by GitHub
parent 0b5f740db5
commit 088b8d2239
6 changed files with 47 additions and 46 deletions
@@ -1,17 +1,16 @@
import { acceptance } from "helpers/qunit-helpers";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
import { stubStripe } from "discourse/plugins/discourse-subscriptions/helpers/stripe";
acceptance("Discourse Subscriptions", {
beforeEach() {
acceptance("Discourse Subscriptions", function (needs) {
needs.user();
needs.hooks.beforeEach(() => {
stubStripe();
},
});
loggedIn: true
});
test("viewing product page", async (assert) => {
await visit("/s");
QUnit.test("viewing product page", async assert => {
await visit("/s");
assert.ok($(".product-list").length, "has product page");
assert.ok($(".product:first-child a").length, "has a link");
assert.ok($(".product-list").length, "has product page");
assert.ok($(".product:first-child a").length, "has a link");
});
});
@@ -1,23 +1,25 @@
import { acceptance } from "helpers/qunit-helpers";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
import { stubStripe } from "discourse/plugins/discourse-subscriptions/helpers/stripe";
acceptance("Discourse Subscriptions", {
beforeEach() {
acceptance("Discourse Subscriptions", function (needs) {
needs.user();
needs.hooks.beforeEach(() => {
stubStripe();
},
});
loggedIn: true
});
test("subscribing", async (assert) => {
await visit("/s");
QUnit.test("subscribing", async assert => {
await visit("/s");
await click(".product:first-child a");
await click(".product:first-child a");
assert.ok(
$(".discourse-subscriptions-section-columns").length,
"has the sections for billing"
);
assert.ok(
$(".discourse-subscriptions-section-columns").length,
"has the sections for billing"
);
assert.ok($(".subscribe-buttons button").length, "has buttons for subscribe");
assert.ok(
$(".subscribe-buttons button").length,
"has buttons for subscribe"
);
});
});