This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/tests/acceptance/topic-anonymous-test.js
Robin Ward 71d37953d5 REFACTOR: Import QUnit and related helpers rather than globals
We used many global functions to handle tests when they should be
imported like other libraries in our application. This also gets us
closer to the way Ember CLI prefers our tests to be laid out.
2020-10-07 11:50:49 -04:00

37 lines
1.3 KiB
JavaScript

import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
acceptance("Topic - Anonymous");
test("Enter a Topic", async (assert) => {
await visit("/t/internationalization-localization/280/1");
assert.ok(exists("#topic"), "The topic was rendered");
assert.ok(exists("#topic .cooked"), "The topic has cooked posts");
assert.ok(
find(".shared-draft-notice").length === 0,
"no shared draft unless there's a dest category id"
);
});
test("Enter without an id", async (assert) => {
await visit("/t/internationalization-localization");
assert.ok(exists("#topic"), "The topic was rendered");
});
test("Enter a 404 topic", async (assert) => {
await visit("/t/not-found/404");
assert.ok(!exists("#topic"), "The topic was not rendered");
assert.ok(exists(".topic-error"), "An error message is displayed");
});
test("Enter without access", async (assert) => {
await visit("/t/i-dont-have-access/403");
assert.ok(!exists("#topic"), "The topic was not rendered");
assert.ok(exists(".topic-error"), "An error message is displayed");
});
test("Enter with 500 errors", async (assert) => {
await visit("/t/throws-error/500");
assert.ok(!exists("#topic"), "The topic was not rendered");
assert.ok(exists(".topic-error"), "An error message is displayed");
});