Skip to content

Commit af71b09

Browse files
authored
DEV: bring back admin search page priority test (#32644)
In this PR, test was removed #32639 To be sure result are consistent, we need to define a data set which will confirm that the page is getting bonus points.
1 parent 713fa88 commit af71b09

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

app/assets/javascripts/discourse/tests/unit/services/admin-search-data-source-test.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,34 @@ module("Unit | Service | AdminSearchDataSource", function (hooks) {
146146
let results = this.subject.search("about your title");
147147
assert.deepEqual(results[0].label, "About your site > Title");
148148
});
149+
150+
test("search - prioritize pages", async function (assert) {
151+
this.subject.componentDataSourceItems = [];
152+
this.subject.reportDataSourceItems = [];
153+
this.subject.themeDataSourceItems = [];
154+
this.subject.pageDataSourceItems = [
155+
{
156+
description: "first page",
157+
icon: "house",
158+
keywords: "exact setting",
159+
label: "Page about exact setting",
160+
type: "page",
161+
url: "/admin",
162+
},
163+
];
164+
this.subject.settingDataSourceItems = [
165+
{
166+
description: "first setting",
167+
icon: "house",
168+
keywords: "exact setting",
169+
label: "exact setting",
170+
type: "setting",
171+
url: "/admin",
172+
},
173+
];
174+
let results = this.subject.search("exact setting");
175+
assert.deepEqual(results[0].label, "Page about exact setting");
176+
});
149177
});
150178

151179
module(

0 commit comments

Comments
 (0)