update to latest standards

This commit is contained in:
2017-05-27 23:02:51 +02:00
parent a5a69ef25e
commit b5f0bdc8e8
6 changed files with 339 additions and 48 deletions

View File

@@ -1,25 +1,26 @@
import 'typings-test'
import * as should from 'should'
import { tap, expect } from 'tapbundle'
import * as smartfm from '../dist/index'
describe('smartfm', function () {
let testSmartfm = new smartfm.Smartfm({ fmType: 'yaml' })
it('.parse()', function () {
let testString = `---
let testSmartfm = new smartfm.Smartfm({ fmType: 'yaml' })
tap.test('.parse()', async () => {
let testString = `---
testKey: testValue
testKey2: testValue2
---
# some markdown`
let parsedString = testSmartfm.parse(testString)
should(parsedString.data).have.property('testKey', 'testValue')
should(parsedString.data).have.property('testKey2', 'testValue2')
should(parsedString.orig).equal(testString)
})
it('.stringify', function () {
let testStringPure = `# some markdown heading\nsome first row`
let testStringCombined = testSmartfm.stringify(testStringPure, { testData: 'hi' })
let resultString = '---\ntestData: hi\n---\n# some markdown heading\nsome first row\n'
should(resultString).equal(testStringCombined)
})
# some markdown
`
let parsedString = testSmartfm.parse(testString)
expect(parsedString.data).to.have.property('testKey', 'testValue')
expect(parsedString.data).to.have.property('testKey2', 'testValue2')
expect(parsedString.orig).to.equal(testString)
})
tap.test('.stringify', async () => {
let testStringPure = `# some markdown heading\nsome first row`
let testStringCombined = testSmartfm.stringify(testStringPure, { testData: 'hi' })
let resultString = '---\ntestData: hi\n---\n# some markdown heading\nsome first row\n'
expect(resultString).to.equal(testStringCombined)
})
tap.start()