2015-04-17 01:53:30 +08:00
|
|
|
import { acceptance } from "helpers/qunit-helpers";
|
|
|
|
acceptance("Topic - Anonymous");
|
|
|
|
|
2017-06-15 01:57:58 +08:00
|
|
|
QUnit.test("Enter a Topic", assert => {
|
2015-04-17 01:53:30 +08:00
|
|
|
visit("/t/internationalization-localization/280/1");
|
|
|
|
andThen(() => {
|
2017-06-15 01:57:58 +08:00
|
|
|
assert.ok(exists("#topic"), "The topic was rendered");
|
|
|
|
assert.ok(exists("#topic .cooked"), "The topic has cooked posts");
|
2018-03-14 03:59:12 +08:00
|
|
|
assert.ok(find('.shared-draft-notice').length === 0, "no shared draft unless there's a dest category id");
|
2015-04-17 01:53:30 +08:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2017-06-15 01:57:58 +08:00
|
|
|
QUnit.test("Enter without an id", assert => {
|
2015-04-17 01:53:30 +08:00
|
|
|
visit("/t/internationalization-localization");
|
|
|
|
andThen(() => {
|
2017-06-15 01:57:58 +08:00
|
|
|
assert.ok(exists("#topic"), "The topic was rendered");
|
2015-04-17 01:53:30 +08:00
|
|
|
});
|
|
|
|
});
|
2015-05-28 01:53:49 +08:00
|
|
|
|
2017-06-15 01:57:58 +08:00
|
|
|
QUnit.test("Enter a 404 topic", assert => {
|
2015-06-11 01:12:15 +08:00
|
|
|
visit("/t/not-found/404");
|
|
|
|
andThen(() => {
|
|
|
|
assert.ok(!exists("#topic"), "The topic was not rendered");
|
|
|
|
assert.ok(find(".not-found").text() === "not found", "it renders the error message");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2017-06-15 01:57:58 +08:00
|
|
|
QUnit.test("Enter without access", assert => {
|
2015-05-28 01:53:49 +08:00
|
|
|
visit("/t/i-dont-have-access/403");
|
|
|
|
andThen(() => {
|
|
|
|
assert.ok(!exists("#topic"), "The topic was not rendered");
|
|
|
|
assert.ok(exists(".topic-error"), "An error message is displayed");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2017-06-15 01:57:58 +08:00
|
|
|
QUnit.test("Enter with 500 errors", assert => {
|
2015-05-28 01:53:49 +08:00
|
|
|
visit("/t/throws-error/500");
|
|
|
|
andThen(() => {
|
|
|
|
assert.ok(!exists("#topic"), "The topic was not rendered");
|
|
|
|
assert.ok(exists(".topic-error"), "An error message is displayed");
|
|
|
|
});
|
2018-03-14 03:59:12 +08:00
|
|
|
});
|