All files / apps/huella-legal/layers/articles/server/services hiddenTerms.ts

100% Statements 4/4
100% Branches 4/4
100% Functions 2/2
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10      7x 43x     7x 26x  
import type { ArticleSummary } from "../../shared/types/ArticleSummary";
import type { Category } from "../../shared/types/Category";
 
export const isHiddenTerm = ({ slug }: Pick<Category, "slug">): boolean =>
    useRuntimeConfig().articles.hiddenTerms.includes(slug);
 
/** Whether an article may appear in a listing, a search or a feed. */
export const isListed = ({ category, tags }: Pick<ArticleSummary, "category" | "tags">): boolean =>
    !(category && isHiddenTerm(category)) && !tags.some(isHiddenTerm);