const path = require('path') const fs = require('fs') const {processMessage} = require('../processors/parsing') const BASE_PATH = path.join(__dirname, 'fixtures') it('parses the message correctly', (done) => { const bodyPath = path.join(BASE_PATH, '1-99174-body.txt') const headersPath = path.join(BASE_PATH, '1-99174-headers.txt') const rawBody = fs.readFileSync(bodyPath, 'utf8') const rawHeaders = fs.readFileSync(headersPath, 'utf8') const message = { rawHeaders, rawBody } const bodyPart = `

In _data/apps.yml:

` processMessage({message}).then((processed) => { expect(processed.headers['in-reply-to']).toEqual('') expect(processed.messageId).toEqual('') expect(processed.subject).toEqual('Re: [electron/electron.atom.io] Add Jasper app (#352)') expect(processed.body.includes(bodyPart)).toBe(true) done() }) })