Skip to content

Commit 947f3e7

Browse files
committed
fix: more tests
1 parent 444db21 commit 947f3e7

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export function applyDefaultCollectionMigration(model: IModel): IModel {
8989
searchCategoryToCollection[searchCategory.key as SearchCategories];
9090
const collection = baseCollectionMap[collectionKey];
9191
collection.label = searchCategory.overrideText || null;
92-
collection.displayConfig.hidden = searchCategory.hidden;
92+
collection.displayConfig.hidden = !!searchCategory.hidden;
9393
return collection;
9494
});
9595

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

+4-10
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,7 @@ describe("applyDefaultCollectionMigration", () => {
4747
const hiddenStatuses = result.data.catalog.collections.map(
4848
(c: IHubCollection) => c.displayConfig?.hidden
4949
);
50-
expect(hiddenStatuses).toEqual([
51-
undefined,
52-
true,
53-
undefined,
54-
undefined,
55-
undefined,
56-
]);
50+
expect(hiddenStatuses).toEqual([false, true, false, false, false]);
5751
});
5852

5953
it("Reorders, re-labels, and hides default collections when search categories are configured", () => {
@@ -97,7 +91,7 @@ describe("applyDefaultCollectionMigration", () => {
9791
const hiddenStatuses = result.data.catalog.collections.map(
9892
(c: IHubCollection) => c.displayConfig.hidden
9993
);
100-
expect(hiddenStatuses).toEqual([undefined, undefined, true, false, false]);
94+
expect(hiddenStatuses).toEqual([false, false, true, false, false]);
10195
});
10296

10397
it("Handles when a site has the 'initiatives' search category saved", () => {
@@ -123,7 +117,7 @@ describe("applyDefaultCollectionMigration", () => {
123117
const hiddenStatuses = result.data.catalog.collections.map(
124118
(c: IHubCollection) => c.displayConfig.hidden
125119
);
126-
expect(hiddenStatuses).toEqual([undefined, true]);
120+
expect(hiddenStatuses).toEqual([false, true]);
127121
});
128122

129123
it("Omits unsupported search categories, like an explicit 'all' or events", () => {
@@ -152,6 +146,6 @@ describe("applyDefaultCollectionMigration", () => {
152146
const hiddenStatuses = result.data.catalog.collections.map(
153147
(c: IHubCollection) => c.displayConfig.hidden
154148
);
155-
expect(hiddenStatuses).toEqual([undefined]);
149+
expect(hiddenStatuses).toEqual([false]);
156150
});
157151
});

0 commit comments

Comments
 (0)