Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

corrects posts.json to no longer have titles #533

Merged
merged 5 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
987 changes: 318 additions & 669 deletions posts.json

Large diffs are not rendered by default.

5,085 changes: 4,810 additions & 275 deletions src/lib/__snapshots__/getPosts.spec-snapshot.ts.snap

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/lib/getArchives.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ describe("getArchives", () => {

it("sorts posts by date", async () => {
vi.mocked(readSources).mockReturnValue([
meta({ title: "A", date: "2013-02-22" }),
meta({ title: "B", date: "2013-02-21" }),
meta({ slug: "A", date: "2013-02-22" }),
meta({ slug: "B", date: "2013-02-21" }),
]);

const result = await getArchives();

expect(result[0]?.months[0]?.posts[0]?.title).toEqual("B");
expect(result[0]?.months[0]?.posts[0]?.slug).toEqual("B");
});
});
1 change: 1 addition & 0 deletions src/lib/getPosts.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import meta from "./test/meta";
describe("getPosts", () => {
beforeEach(() => {
vi.mocked(readSources).mockReturnValue([meta()]);
vi.mocked(fetchPost).mockResolvedValue(ether());
});

it("only loads sources once", async () => {
Expand Down
4 changes: 2 additions & 2 deletions src/lib/test/ether.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ export default function ether({
before = "",
content = "",
after = "",
title,
title = "the_title",
}: {
frontmatter?: Record<string, unknown>;
before?: string;
content?: string;
after?: string;
title?: string;
title?: string | undefined | null;
redirects?: string[];
} = {}): string {
return `${before}
Expand Down
1 change: 0 additions & 1 deletion src/lib/test/meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ export default function meta(
): Record<string, unknown> {
const id = Math.random().toString(36).slice(2, 9);
const obj = {
title: `the_title_${id}`,
source: `doc.bmndr.co/the_source_${id}`,
date: "2011-01-24",
slug: `the_slug_${id}`,
Expand Down
Loading
Loading