recital / packages / ext-common-commands / test / include-command.spec.js
include-command.spec.js
Raw
const assert = require('assert')
const fs = require('fs')
const path = require('path')
const resolveIncludes = require('../dist/common-commands-ext').resolveIncludes
const eol = require('eol')

it('should concatenate files with the $include command', () => {
	const entryPath = path.resolve(__dirname, './include-command/entry.stage')
	const str = fs.readFileSync(entryPath, 'utf-8')
	console.log(resolveIncludes)
	const included = resolveIncludes(fs, path, entryPath, str)
	const expected = fs.readFileSync(
		path.resolve(__dirname, './include-command/expected.stage'),
		'utf-8'
	)

	assert.strictEqual(eol.lf(included), eol.lf(expected))
})