recital / packages / ext-common-commands / test / wiki-link.spec.js
wiki-link.spec.js
Raw
const assert = require('assert')
const fs = require('fs')
const path = require('path')
const parse = require('@a-morphous/recital').default
const genFlattenedObject = require('@a-morphous/recital').genFlattenedObject
const convertWikiLinksToMd = require('../dist/common-commands-ext').convertWikiLinkToMd

it('should convert wiki links to regular links', () => {
	const entryPath = path.resolve(__dirname, './wiki-link/entry.stage')
	const str = fs.readFileSync(entryPath, 'utf-8')
	const stageObjects = parse(str)
	const flatObjects = genFlattenedObject(stageObjects)
	const converted = convertWikiLinksToMd(flatObjects)

	console.log(converted)

	assert.ok(converted)
})