Skip to content

Commit

Permalink
fix: ensure featured content catalogs are returned as an array (#1207)
Browse files Browse the repository at this point in the history
  • Loading branch information
juliannemarik authored Sep 12, 2023
1 parent 9ab01ce commit d28b56f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ import {
WellKnownCatalog,
getWellKnownCatalog,
} from "../../../search/wellKnownCatalog";
import { IHubCatalog } from "../../../search/types/IHubCatalog";

/**
* Return a catalog structured for picking featured content.
* @param user
* @returns
*/
export function getFeaturedContentCatalogs(user: IUser) {
export function getFeaturedContentCatalogs(user: IUser): IHubCatalog[] {
const catalogNames: WellKnownCatalog[] = [
"myContent",
"favorites",
Expand All @@ -27,5 +28,5 @@ export function getFeaturedContentCatalogs(user: IUser) {
return catalog;
});

return { catalogs };
return catalogs;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { getFeaturedContentCatalogs } from "../../../../src/core/schemas/interna
describe("getFeaturedContentCatalogs:", () => {
it("adds user into catalog", () => {
const user: IUser = { username: "darth" } as unknown as IUser;
const chk = getFeaturedContentCatalogs(user);
expect(chk.catalogs.length).toBe(4);
const myContent = chk.catalogs[0];
expect(myContent.scopes.item.filters[0].predicates[0]).toEqual({
const catalogs = getFeaturedContentCatalogs(user);
expect(catalogs.length).toBe(4);
const myContent = catalogs[0];
expect(myContent.scopes?.item?.filters[0].predicates[0]).toEqual({
owner: "darth",
});
});
Expand Down

0 comments on commit d28b56f

Please sign in to comment.