use jest snapshots
This commit is contained in:
parent
7d2cb559a4
commit
542302f171
|
@ -1,6 +1,6 @@
|
|||
const fs = require('fs')
|
||||
|
||||
const fakedata = fs.readFileSync('./test/expected-goodreads-content.js')
|
||||
const fakedata = fs.readFileSync('./test/__mocks__/expected-goodreads-content.js')
|
||||
|
||||
function getmock(url, callback) {
|
||||
callback({
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`howlong adds howlong to beat id and hours to frontmatter 1`] = `
|
||||
"---
|
||||
title: \\"wizardry 8 review\\"
|
||||
howlongtobeat_id: 11228
|
||||
howlongtobeat_hrs: 93
|
||||
game_name: \\"Wizardry 8\\"
|
||||
---
|
||||
|
||||
blabla nice one 9/10 GG!
|
||||
"
|
||||
`;
|
|
@ -0,0 +1,13 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`mastodon feed parser tests parse creates correct MD structure 1`] = `
|
||||
"---
|
||||
source: \\"https://chat.brainbaking.com/objects/77a3ecfb-47e1-4d7a-a24a-8b779d80a8ac\\"
|
||||
context: \\"\\"
|
||||
title: \\"I pulled the Google plug and installed LineageOS: https://brainbaking.com/post/2021/03/getting-ri...\\"
|
||||
date: \\"2021-03-01T19:03:35\\"
|
||||
---
|
||||
|
||||
I pulled the Google plug and installed LineageOS: <a href=\\"https://brainbaking.com/post/2021/03/getting-rid-of-tracking-using-lineageos/\\" rel=\\"ugc\\">https://brainbaking.com/post/2021/03/getting-rid-of-tracking-using-lineageos/</a> Very impressed so far! Also rely on my own CalDAV server to replace GCalendar. Any others here running <a class=\\"hashtag\\" data-tag=\\"lineageos\\" href=\\"https://chat.brainbaking.com/tag/lineageos\\" rel=\\"tag ugc\\">#lineageos</a> for privacy reasons?
|
||||
"
|
||||
`;
|
|
@ -1,9 +0,0 @@
|
|||
---
|
||||
source: "https://chat.brainbaking.com/objects/77a3ecfb-47e1-4d7a-a24a-8b779d80a8ac"
|
||||
context: ""
|
||||
title: "I pulled the Google plug and installed LineageOS: https://brainbaking.com/post/2021/03/getting-ri..."
|
||||
date: "2021-03-01T19:03:35"
|
||||
---
|
||||
|
||||
I pulled the Google plug and installed LineageOS: <a href="https://brainbaking.com/post/2021/03/getting-rid-of-tracking-using-lineageos/" rel="ugc">https://brainbaking.com/post/2021/03/getting-rid-of-tracking-using-lineageos/</a> Very impressed so far! Also rely on my own CalDAV server to replace GCalendar. Any others here running <a class="hashtag" data-tag="lineageos" href="https://chat.brainbaking.com/tag/lineageos" rel="tag ugc">#lineageos</a> for privacy reasons?
|
||||
|
|
@ -13,16 +13,6 @@ game_name: "Wizardry 8"
|
|||
blabla nice one 9/10 GG!
|
||||
`
|
||||
|
||||
const expectedmd = `---
|
||||
title: "wizardry 8 review"
|
||||
howlongtobeat_id: 11228
|
||||
howlongtobeat_hrs: 93
|
||||
game_name: "Wizardry 8"
|
||||
---
|
||||
|
||||
blabla nice one 9/10 GG!
|
||||
`
|
||||
|
||||
const dumpdir = `${__dirname}/howlong-stub`
|
||||
beforeEach(async () => {
|
||||
if(fs.existsSync(dumpdir)) {
|
||||
|
@ -37,5 +27,5 @@ test('howlong adds howlong to beat id and hours to frontmatter', async () => {
|
|||
await howlong(dumpdir)
|
||||
|
||||
const actualmd = await fsp.readFile(`${dumpdir}/howlongtobeat-sample.md`, 'utf-8')
|
||||
expect(actualmd).toEqual(expectedmd)
|
||||
expect(actualmd).toMatchSnapshot()
|
||||
})
|
||||
|
|
|
@ -35,10 +35,8 @@ describe("mastodon feed parser tests", () => {
|
|||
notesdir: dumpdir
|
||||
})
|
||||
|
||||
const actualMd = await fsp.readFile(`${dumpdir}/2021/03/01h19m3s35.md`).toString()
|
||||
const expectedMd = await fsp.readFile(`${__dirname}/expected-01h19m3s35.md`).toString()
|
||||
|
||||
expect(actualMd).toEqual(expectedMd)
|
||||
const actualMd = (await fsp.readFile(`${dumpdir}/2021/03/01h19m3s35.md`)).toString()
|
||||
expect(actualMd).toMatchSnapshot()
|
||||
})
|
||||
|
||||
test("parse creates MD with context if in-reply-to", async () => {
|
||||
|
|
Loading…
Reference in New Issue