const { assert } = require('chai') const fs = require('fs') describe('Parser Markdown', function () { // default file const markdownData = fs.readFileSync('./ressources/index.md', 'utf8') // get function parseMarkdownFile const parseMarkdownFile = require('./../src/parsers/markdown.js') // start parsing const result = parseMarkdownFile(markdownData) // check results it('fields exists', function() { assert.notEqual(result.fields, undefined) }) it('fields is object', function() { assert.isObject(result.fields) }) it('fields are valid', function() { assert.deepEqual(result.fields, { media: { src: { sizes: [{ width: 300 }, { height: 100, width: 500 } ], src: '_images/dog.jpg' } }, title: 'health goth DIY tattooed', view: 'page.njk', meta: { description: 'DSA yes plz hot chicken green juice' } }) }) it('content exists', function() { assert.notEqual(result.content, '') }) it('content has html', function() { assert.match(result.content, /

Normcore cold-pressed ramps DSA<\/h2>/) }) })