Skip to content

Commit 444db21

Browse files
committed
fix: tets
1 parent 880bced commit 444db21

File tree

4 files changed

+25
-7
lines changed

4 files changed

+25
-7
lines changed

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/common/src/sites/_internal/reflectCollectionsToSearchCategories.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export function reflectCollectionsToSearchCategories(model: IModel) {
4545
const searchCategoryKey =
4646
collectionToSearchCategory[c.key as WellKnownCollection];
4747
const updated: any = {
48-
hidden: c.displayConfig?.hidden,
48+
hidden: !!c.displayConfig?.hidden,
4949
key: searchCategoryKey,
5050
queryParams: {
5151
collection: searchCategoryToQueryParam[searchCategoryKey],

packages/common/test/sites/_internal/reflectCollectionsToSearchCategories.test.ts

+18
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,17 @@ describe("reflectCollectionsToSearchCategories", () => {
5555
filters: [],
5656
},
5757
} as IHubCollection,
58+
{
59+
label: null,
60+
key: "appAndMap",
61+
targetEntity: "item",
62+
// intentionally leaving out displayConfig.hidden for branch coverage
63+
scope: {
64+
targetEntity: "item",
65+
collection: "appAndMap",
66+
filters: [],
67+
},
68+
} as IHubCollection,
5869
];
5970

6071
const result = reflectCollectionsToSearchCategories(site);
@@ -73,6 +84,13 @@ describe("reflectCollectionsToSearchCategories", () => {
7384
collection: "Document",
7485
},
7586
},
87+
{
88+
key: SearchCategories.APPS_AND_MAPS,
89+
hidden: false,
90+
queryParams: {
91+
collection: "App,Map",
92+
},
93+
},
7694
]);
7795
});
7896
it("handles re-labeled collections", () => {

packages/common/test/sites/get-catalog-from-site-model.ts packages/common/test/sites/get-catalog-from-site-model.test.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,19 @@ describe("getCatalogFromSiteModel", () => {
1515

1616
expect(chk.title).toBe("Default Site Catalog");
1717
expect(chk.scopes).toBeDefined();
18-
expect(chk.scopes?.item?.filters.length).toBe(1);
19-
expect(chk.scopes?.item?.filters[0].predicates[0].group).toEqual([
18+
expect(chk.scopes.item.filters.length).toBe(1);
19+
expect(chk.scopes.item.filters[0].predicates[0].group).toEqual([
2020
"00c",
2121
"00d",
2222
]);
23-
expect(chk.scopes?.event?.filters.length).toBe(1);
24-
expect(chk.scopes?.event?.filters[0].predicates[0].group).toEqual([
23+
expect(chk.scopes.event.filters.length).toBe(1);
24+
expect(chk.scopes.event.filters[0].predicates[0].group).toEqual([
2525
"00c",
2626
"00d",
2727
]);
2828

2929
// check for collections
30-
expect(chk.collections?.map((c) => c.key)).toEqual([
30+
expect(chk.collections.map((c) => c.key)).toEqual([
3131
"all",
3232
"site",
3333
"dataset",

0 commit comments

Comments
 (0)