* Running the tests only in the ember cli env hid the fact that the pending posts feature wasn't working in the legacy environment * Tests were using ember-cli-only APIs while there are widely used testing APIs in Discourse that support both ember envs * `ember-test-selectors` was in both dependencies and devDependencies in discourse/package.json * `qunit-dom` in package.json was not only unused but also defunct, as it wasn't pulled into the legacy env app A followup to #14501, and #15128.
27 lines
783 B
JavaScript
27 lines
783 B
JavaScript
import {
|
|
acceptance,
|
|
count,
|
|
exists,
|
|
} from "discourse/tests/helpers/qunit-helpers";
|
|
import { test } from "qunit";
|
|
import { click, visit } from "@ember/test-helpers";
|
|
|
|
acceptance("Pending posts - no existing pending posts", function (needs) {
|
|
needs.user();
|
|
|
|
test("No link to pending posts", async function (assert) {
|
|
await visit("/u/eviltrout");
|
|
assert.ok(!exists(".action-list [href='/u/eviltrout/activity/pending']"));
|
|
});
|
|
});
|
|
|
|
acceptance("Pending posts - existing pending posts", function (needs) {
|
|
needs.user({ pending_posts_count: 2 });
|
|
|
|
test("Navigate to pending posts", async function (assert) {
|
|
await visit("/u/eviltrout");
|
|
await click("[href='/u/eviltrout/activity/pending']");
|
|
assert.strictEqual(count(".user-stream-item"), 2);
|
|
});
|
|
});
|