feat(core-cms): compose @repo/blog/cms into payload config
This commit is contained in:
@@ -5,11 +5,9 @@ vi.mock("payload", () => ({
|
||||
getPayload: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock("@repo/core-cms", () => ({
|
||||
default: {} as never,
|
||||
}));
|
||||
|
||||
describe("PayloadArticlesRepository", () => {
|
||||
const mockConfig = {} as never;
|
||||
|
||||
it("maps a Payload doc to a domain Article on getArticleBySlug", async () => {
|
||||
const { getPayload } = await import("payload");
|
||||
const findMock = vi.fn().mockResolvedValue({
|
||||
@@ -30,7 +28,7 @@ describe("PayloadArticlesRepository", () => {
|
||||
find: findMock,
|
||||
});
|
||||
|
||||
const repo = new PayloadArticlesRepository();
|
||||
const repo = new PayloadArticlesRepository(mockConfig);
|
||||
const result = await repo.getArticleBySlug("hello");
|
||||
|
||||
expect(findMock).toHaveBeenCalledWith({
|
||||
@@ -52,7 +50,7 @@ describe("PayloadArticlesRepository", () => {
|
||||
find: vi.fn().mockResolvedValue({ docs: [] }),
|
||||
});
|
||||
|
||||
const repo = new PayloadArticlesRepository();
|
||||
const repo = new PayloadArticlesRepository(mockConfig);
|
||||
const result = await repo.getArticleBySlug("missing");
|
||||
expect(result).toBeUndefined();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user