Merge pull request #2 from ellaestigoy/add-test

Add tests
This commit is contained in:
Ella E 2022-04-06 10:09:57 -06:00 committed by GitHub
commit bd3689ca0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 51 additions and 0 deletions

View File

@ -0,0 +1,51 @@
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
acceptance("Gated Category - Anonymous", function (needs) {
needs.hooks.beforeEach(() => {
settings.enabled_categories = "2";
});
needs.hooks.afterEach(() => {
settings.enabled_categories = "";
});
test("Viewing Topic in gated category", async function (assert) {
await visit("/t/internationalization-localization/280");
assert.ok(
query(".topic-in-gated-category .custom-gated-topic-content"),
"gated category prompt shown for anons on selected category"
);
});
test("Viewing Topic in non-gated category", async function (assert) {
await visit("/t/34");
assert.notOk(
query(".topic-in-gated-category .custom-gated-topic-content"),
"gated category prompt shown for anons on selected category"
);
});
});
acceptance("Gated Category - Logged In", function (needs) {
needs.user();
needs.hooks.beforeEach(() => {
settings.enabled_categories = "2";
});
needs.hooks.afterEach(() => {
settings.enabled_categories = "";
});
test("Viewing Topic in gated category", async function (assert) {
await visit("/t/internationalization-localization/280");
assert.notOk(
query(".topic-in-gated-category .custom-gated-topic-content"),
"gated category prompt not shown on selected category"
);
});
});