commit
message
Adding tests for specific formulas with SheetFormulaTest.ts
author
Ben Vogt <[email protected]>
date
2016-12-31 22:21:31
stats
1 file(s) changed,
18 insertions(+),
0 deletions(-)
files
tests/SheetFormulaTest.ts
1diff --git a/tests/SheetFormulaTest.ts b/tests/SheetFormulaTest.ts
2new file mode 100644
3index 0000000..1f62013
4--- /dev/null
5+++ b/tests/SheetFormulaTest.ts
6@@ -0,0 +1,18 @@
7+import { Sheet } from "../src/Sheet"
8+import {assertEquals, assertArrayEquals} from "./utils/Asserts"
9+
10+//Test CONCATENATE formula
11+var sheet = new Sheet();
12+sheet.setCell("A1", "Hello, ");
13+sheet.setCell("A2", "World!");
14+sheet.setCell("A3", "=CONCATENATE(A1, A2)");
15+sheet.setCell("B1", "1000");
16+sheet.setCell("B2", "=CONCATENATE(A1, B1)");
17+var cell = sheet.getCell("A3");
18+assertEquals("Hello, World!", cell.value);
19+assertEquals(null, cell.error)
20+assertArrayEquals(['A1', 'A2'], cell.dependencies);
21+var cell = sheet.getCell("B2");
22+assertEquals("Hello, 1000", cell.value);
23+assertEquals(null, cell.error)
24+assertArrayEquals(['A1', 'B1'], cell.dependencies);