mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-27 05:25:17 +00:00
22 lines
726 B
TypeScript
22 lines
726 B
TypeScript
import { describe, it, expect } from 'vitest';
|
|
import { formatObjectForTable } from '@/shared/objectToTableItems';
|
|
|
|
describe('objectArray.ts', () => {
|
|
it('converts object array', () => {
|
|
const originalObj = {
|
|
XXX1: [{ Profit: 20 }, { Loss: 50 }],
|
|
XXX2: [{ Profit: 50 }, { Loss: 21 }],
|
|
};
|
|
const expected = [
|
|
{ metric: 'Profit', XXX1: 20, XXX2: 50 },
|
|
{ metric: 'Loss', XXX1: 50, XXX2: 21 },
|
|
];
|
|
const expected2 = [
|
|
{ settings: 'Profit', XXX1: 20, XXX2: 50 },
|
|
{ settings: 'Loss', XXX1: 50, XXX2: 21 },
|
|
];
|
|
expect(formatObjectForTable(originalObj, 'metric')).toEqual(expected);
|
|
expect(formatObjectForTable(originalObj, 'settings')).toEqual(expected2);
|
|
});
|
|
});
|