calculate-items
Version:
Items calculation template
46 lines (44 loc) • 1.19 kB
text/typescript
import {LINE_SPLITTER} from "../../constants/patterns";
import {splitLineText} from "../../utils/itemSplitter";
const expression = [
// {
// input: `
// Non-2 - 4000 - 200`,
// output: [
// ["Non-2", "4000 - 200"],
// ]
// },
{
input: `Osh [1, 2] - 43 000 so'm
Sho'rva[4] - 23 400 so'm
Choy - 3500 so'm
Non - 4000 so'm
Pomidor-Salat - 4000 + 1000 - 2000 -7000
Non-2 - 4000 - 200
Non 2 - 4000 - 200
Limon-choy - 5000
Sok - 7000-3000
Xizmat - 12%`,
output: [
["Osh [1, 2]", "43 000 so'm"],
["Sho'rva[4]", "23 400 so'm"],
["Choy", "3500 so'm"],
["Non", "4000 so'm"],
["Pomidor-Salat", "4000 + 1000 - 2000 -7000"],
["Non", "2 - 4000 - 200"],
["Non 2", "4000 - 200"],
["Limon-choy", "5000"],
["Sok", "7000-3000"],
["Xizmat", "12%"]
]
}
]
describe('ItemsFormatter.splitLineText(text)', () => {
test('Summary total format', () => {
expression.forEach(item => {
const result = item.input.split(LINE_SPLITTER).map(splitLineText)
expect(result)
.toEqual(item.output);
})
});
});