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

1
test/test.d.ts vendored
View File

@ -1 +0,0 @@
import 'typings-test';

View File

@ -1,25 +0,0 @@
"use strict";
require("typings-test");
const should = require("should");
const smartfm = require("../dist/index");
describe('smartfm', function () {
let testSmartfm = new smartfm.Smartfm({ fmType: 'yaml' });
it('.parse()', function () {
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);
});
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLHdCQUFxQjtBQUNyQixpQ0FBZ0M7QUFFaEMseUNBQXdDO0FBRXhDLFFBQVEsQ0FBQyxTQUFTLEVBQUU7SUFDaEIsSUFBSSxXQUFXLEdBQUcsSUFBSSxPQUFPLENBQUMsT0FBTyxDQUFDLEVBQUUsTUFBTSxFQUFFLE1BQU0sRUFBRSxDQUFDLENBQUE7SUFDekQsRUFBRSxDQUFDLFVBQVUsRUFBRTtRQUNYLElBQUksVUFBVSxHQUFHOzs7O2dCQUlULENBQUE7UUFDUixJQUFJLFlBQVksR0FBRyxXQUFXLENBQUMsS0FBSyxDQUFDLFVBQVUsQ0FBQyxDQUFBO1FBQ2hELE1BQU0sQ0FBQyxZQUFZLENBQUMsSUFBSSxDQUFDLENBQUMsSUFBSSxDQUFDLFFBQVEsQ0FBQyxTQUFTLEVBQUUsV0FBVyxDQUFDLENBQUE7UUFDL0QsTUFBTSxDQUFDLFlBQVksQ0FBQyxJQUFJLENBQUMsQ0FBQyxJQUFJLENBQUMsUUFBUSxDQUFDLFVBQVUsRUFBRSxZQUFZLENBQUMsQ0FBQTtRQUNqRSxNQUFNLENBQUMsWUFBWSxDQUFDLElBQUksQ0FBQyxDQUFDLEtBQUssQ0FBQyxVQUFVLENBQUMsQ0FBQTtJQUMvQyxDQUFDLENBQUMsQ0FBQTtJQUNGLEVBQUUsQ0FBQyxZQUFZLEVBQUU7UUFDYixJQUFJLGNBQWMsR0FBRyx5Q0FBeUMsQ0FBQTtRQUM5RCxJQUFJLGtCQUFrQixHQUFHLFdBQVcsQ0FBQyxTQUFTLENBQUMsY0FBYyxFQUFFLEVBQUUsUUFBUSxFQUFFLElBQUksRUFBRSxDQUFDLENBQUE7UUFDbEYsSUFBSSxZQUFZLEdBQUcsbUVBQW1FLENBQUE7UUFDdEYsTUFBTSxDQUFDLFlBQVksQ0FBQyxDQUFDLEtBQUssQ0FBQyxrQkFBa0IsQ0FBQyxDQUFBO0lBQ2xELENBQUMsQ0FBQyxDQUFBO0FBQ04sQ0FBQyxDQUFDLENBQUEifQ==

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()