Skip to content

Commit

Permalink
create a store stub for integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
kcinay055679 committed May 2, 2024
1 parent 8e04753 commit 0bb9b18
Showing 1 changed file with 33 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
import { module, test } from "qunit";
import { setupRenderingTest } from "ember-qunit";
import { render } from "@ember/test-helpers";
import { render, pauseTest } from "@ember/test-helpers";
import { hbs } from "ember-cli-htmlbars";


const storeStub = Service.extend({
query(modelName, params) {
if (params) {
return Promise.all([
{ name: "Team1", description: "description1" },
{ name: "Team2", description: "description2" },
]);
}
}
});

module("Integration | Component | admin/user/deletion-form", function (hooks) {
setupRenderingTest(hooks);


hooks.beforeEach(function () {
this.owner.unregister("service:store");
this.owner.register("service:store", storeStub);
});

test("it renders with block", async function (assert) {
await render(hbs`
<Admin::User::DeletionForm>
Expand All @@ -15,4 +33,18 @@ module("Integration | Component | admin/user/deletion-form", function (hooks) {

assert.equal(this.element.textContent.trim(), "Delete");
});

test("it renders with block", async function (assert) {
this.set("user", {
id: 12,
givenname: "Bob",
surname: "Muster",
username: "bob"
});

await render(hbs `<Admin::User::DeletionForm @user={{this.user}}/>`);
await pauseTest();

assert.equal(this.element.textContent.trim(), "Delete");
});
});

0 comments on commit 0bb9b18

Please sign in to comment.