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/integration/components/pending-post-test.js
Jarek Radosz 25aa0bc10d
DEV: Deprecate create-store test helper (#19021)
Use the regular Store service instead.
2022-11-16 10:54:46 +01:00

32 lines
990 B
JavaScript

import { module, test } from "qunit";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
import { render } from "@ember/test-helpers";
import { query } from "discourse/tests/helpers/qunit-helpers";
import { hbs } from "ember-cli-htmlbars";
import { getOwner } from "discourse-common/lib/get-owner";
module("Integration | Component | pending-post", function (hooks) {
setupRenderingTest(hooks);
test("it renders", async function (assert) {
const store = getOwner(this).lookup("service:store");
store.createRecord("category", { id: 2 });
const post = store.createRecord("pending-post", {
id: 1,
topic_url: "topic-url",
username: "USERNAME",
category_id: 2,
raw_text: "**bold text**",
});
this.set("post", post);
await render(hbs`<PendingPost @post={{this.post}}/>`);
assert.strictEqual(
query("p.excerpt").textContent.trim(),
"bold text",
"renders the cooked text"
);
});
});