Skip to content

Commit

Permalink
fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
narthur committed Aug 19, 2023
1 parent a8eb387 commit a97d3e8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
20 changes: 20 additions & 0 deletions src/schemas/legacyPost.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { describe, it, expect } from "vitest";
import { legacyPost } from "./legacyPost";
import loadLegacyData from "../lib/test/loadLegacyData";

describe("legacyPost", () => {
it("generates disqus id", () => {
loadLegacyData([
{
ID: "1",
expost_source_url: "the_url",
},
]);

const p = legacyPost.parse("the_url");

if (!p) throw new Error("p is undefined");

expect(p.disqus_id).toEqual("1 https://blog.beeminder.com/?p=1");
});
});
8 changes: 4 additions & 4 deletions src/schemas/legacyPost.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ export const legacyPost = z
date: wp.Date ? new Date(wp.Date) : undefined,
tags: wp.Tags ? String(wp.Tags).split("|").filter(Boolean) : [],
source: wp.expost_source_url,
disqus_id: `${wp.dsq_thread_id} https://blog.beeminder.com/?p=${wp.dsq_thread_id}`,
disqus_id: `${wp.ID} https://blog.beeminder.com/?p=${wp.ID}`,
author: wp.user?.display_name,
slug: wp.Slug,
commentStatus: wp["Comment Status"],
pingStatus: wp["Ping Status"],
dateModified: wp["Post Modified Date"]
comment_status: wp["Comment Status"],
ping_status: wp["Ping Status"],
date_modified: wp["Post Modified Date"]
? new Date(wp["Post Modified Date"])
: undefined,
status: wp.Status,
Expand Down

0 comments on commit a97d3e8

Please sign in to comment.