recital / exporters / html / test / base.spec.js
base.spec.js
Raw
const assert = require('assert')
const fs = require('fs')
const path = require('path')

const stageToHTML = require('../dist/stage-html').stageToHTML

const testFiles = fs.readdirSync(path.resolve(__dirname, './data/'))

for (let file of testFiles) {
	it(`should parse ${file} correctly`, () => {
		const entryPath = path.resolve(__dirname, 'data', file)
		const expectedPath = path.resolve(__dirname, 'expected', path.basename(file, '.stage') + '.html')
		const str = fs.readFileSync(entryPath, 'utf-8')
		const expected = fs.readFileSync(expectedPath, 'utf-8')

		const result = stageToHTML(str)
		assert.strictEqual(result.trim(), expected.trim())
	})
}