e2e test mastodon with real url

This commit is contained in:
Wouter Groeneveld 2021-03-12 18:54:02 +01:00
parent add5f883f5
commit 90773a2521
1 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,31 @@
const fs = require('fs');
const fsp = require('fs').promises;
const { rmdir } = require('./../utils')
jest.disableAutomock()
jest.unmock('got')
const { parseMastoFeed } = require('../../src/mastodon/feed-parser')
const dumpdir = `${__dirname}/dump`
describe("mastodon feed parser end to end scenario test", () => {
beforeEach(() => {
if(fs.existsSync(dumpdir)) {
rmdir(dumpdir)
}
fs.mkdirSync(dumpdir)
});
test("parse creates separate notes in each month subdir", async () => {
await parseMastoFeed({
url: "https://chat.brainbaking.com/users/wouter/feed",
notesdir: dumpdir
})
let dir = await fsp.readdir(`${dumpdir}/2021/03`, { withFileTypes: true })
expect(dir.length).not.toBe(0)
})
})