BREAKING CHANGE(core): switch to esm

This commit is contained in:
2022-05-20 15:22:56 +02:00
parent c7899742fe
commit 365511fee3
6 changed files with 7704 additions and 8774 deletions

View File

@ -1,6 +1,6 @@
import { expect, tap } from '@pushrocks/tapbundle';
import * as smartyaml from '../ts/index';
import * as smartyaml from '../ts/index.js';
let yamlString = `someKey: someValue
someKey2: someValue2
@ -8,21 +8,21 @@ someKey2: someValue2
tap.test('should convert yaml string to object', async () => {
let myObject = await smartyaml.yamlStringToObject(yamlString);
expect(myObject.someKey).to.equal('someValue');
expect(myObject.someKey2).to.equal('someValue2');
expect(myObject.someKey).toEqual('someValue');
expect(myObject.someKey2).toEqual('someValue2');
});
tap.test('should convert an object to a string', async () => {
let myObject = await smartyaml.yamlStringToObject(yamlString);
let myString = await smartyaml.objectToYamlString(myObject);
expect(myString).to.equal(yamlString);
expect(myString).toEqual(yamlString);
});
// test some behaviours
tap.test('should allow dots in key', async () => {
let testString = `myKey.with.dots: some`;
let testObject = await smartyaml.yamlStringToObject(testString);
expect(testObject['myKey.with.dots']).to.equal('some');
expect(testObject['myKey.with.dots']).toEqual('some');
});
tap.start();