feat(Microsoft Excel 365 Node): Overhaul

This commit is contained in:
Michael Kret
2023-05-02 12:44:25 +03:00
committed by GitHub
parent 25fe14be56
commit 5364a2dff3
75 changed files with 8049 additions and 675 deletions

View File

@@ -1,4 +1,4 @@
import { fuzzyCompare, keysToLowercase } from '../../utils/utilities';
import { fuzzyCompare, keysToLowercase, wrapData } from '../../utils/utilities';
//most test cases for fuzzyCompare are done in Compare Datasets node tests
describe('Test fuzzyCompare', () => {
@@ -30,6 +30,45 @@ describe('Test fuzzyCompare', () => {
});
});
describe('Test wrapData', () => {
it('should wrap object in json', () => {
const data = {
id: 1,
name: 'Name',
};
const wrappedData = wrapData(data);
expect(wrappedData).toBeDefined();
expect(wrappedData).toEqual([{ json: data }]);
});
it('should wrap each object in array in json', () => {
const data = [
{
id: 1,
name: 'Name',
},
{
id: 2,
name: 'Name 2',
},
];
const wrappedData = wrapData(data);
expect(wrappedData).toBeDefined();
expect(wrappedData).toEqual([{ json: data[0] }, { json: data[1] }]);
});
it('json key from source should be inside json', () => {
const data = {
json: {
id: 1,
name: 'Name',
},
};
const wrappedData = wrapData(data);
expect(wrappedData).toBeDefined();
expect(wrappedData).toEqual([{ json: data }]);
expect(Object.keys(wrappedData[0].json)).toContain('json');
});
});
describe('Test keysToLowercase', () => {
it('should convert keys to lowercase', () => {
const headers = {