From bd602b02a0aaebf873ce851f8303c346a43e99f0 Mon Sep 17 00:00:00 2001 From: Isaac Janzen <50783505+janzenisaac@users.noreply.github.com> Date: Thu, 15 Dec 2022 11:35:18 -0600 Subject: [PATCH] Add test for category result (#200) --- .../components/query-result-test.js | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/test/javascripts/integration/components/query-result-test.js b/test/javascripts/integration/components/query-result-test.js index 8f4b7e5..acb375f 100644 --- a/test/javascripts/integration/components/query-result-test.js +++ b/test/javascripts/integration/components/query-result-test.js @@ -139,6 +139,41 @@ discourseModule( ); }, }); + + componentTest("it renders a category_id in query results", { + template: hbs`{{query-result content=content}}`, + + beforeEach() { + const results = { + colrender: { 0: "category" }, + relations: { + category: [ + { + id: 1, + name: "foo", + slug: "foo", + topic_count: 0, + position: 1, + description: "a category", + can_edit: true, + }, + ], + }, + result_count: 1, + columns: [""], + rows: [[1]], + }; + this.set("content", results); + }, + + test(assert) { + assert.ok( + exists( + "table tbody tr:nth-child(1) td:nth-child(1) span.category-name" + ) + ); + }, + }); } );