f7
f7 is a spreadsheet formula execution library
git clone https://git.vogt.world/f7.git
Log | Files | README.md | LICENSE.md
← All files
name: src/test/js/execution/ExecutorErrorTest.ts
-rw-r--r--
3166
 1import { DivException } from "../../../main/js/errors/DivException";
 2import { NAException } from "../../../main/js/errors/NAException";
 3import { NameException } from "../../../main/js/errors/NameException";
 4import { NullException } from "../../../main/js/errors/NullException";
 5import { NumException } from "../../../main/js/errors/NumException";
 6import { ParseException } from "../../../main/js/errors/ParseException";
 7import { RefException } from "../../../main/js/errors/RefException";
 8import { ValueException } from "../../../main/js/errors/ValueException";
 9import { runner, it, describe } from "../testutils/TestUtils";
10
11describe("Executor.execute - Errors", function () {
12  it("should return NULL error", function () {
13    runner()
14      .addCell("Alpha", "A1", "= #NULL!")
15      .addExpectedValue("Alpha", "A1", new NullException())
16      .run();
17    runner()
18      .addCell("Alpha", "A1", "= #null!")
19      .addExpectedValue("Alpha", "A1", new NullException())
20      .run();
21  });
22
23  it("should return DIV error", function () {
24    runner()
25      .addCell("Alpha", "A1", "= #DIV/0!")
26      .addExpectedValue("Alpha", "A1", new DivException())
27      .run();
28    runner()
29      .addCell("Alpha", "A1", "= #div/0!")
30      .addExpectedValue("Alpha", "A1", new DivException())
31      .run();
32  });
33
34  it("should return VALUE error", function () {
35    runner()
36      .addCell("Alpha", "A1", "= #VALUE!")
37      .addExpectedValue("Alpha", "A1", new ValueException())
38      .run();
39    runner()
40      .addCell("Alpha", "A1", "= #value!")
41      .addExpectedValue("Alpha", "A1", new ValueException())
42      .run();
43  });
44
45  it("should return REF error", function () {
46    runner()
47      .addCell("Alpha", "A1", "= #REF!")
48      .addExpectedValue("Alpha", "A1", new RefException())
49      .run();
50    runner()
51      .addCell("Alpha", "A1", "= #ref!")
52      .addExpectedValue("Alpha", "A1", new RefException())
53      .run();
54  });
55
56  it("should return NAME error", function () {
57    runner()
58      .addCell("Alpha", "A1", "= #NAME?")
59      .addExpectedValue("Alpha", "A1", new NameException())
60      .run();
61    runner()
62      .addCell("Alpha", "A1", "= #name?")
63      .addExpectedValue("Alpha", "A1", new NameException())
64      .run();
65  });
66
67  it("should return NUM error", function () {
68    runner()
69      .addCell("Alpha", "A1", "= #NUM!")
70      .addExpectedValue("Alpha", "A1", new NumException())
71      .run();
72    runner()
73      .addCell("Alpha", "A1", "= #num!")
74      .addExpectedValue("Alpha", "A1", new NumException())
75      .run();
76  });
77
78  it("should return NA error", function () {
79    runner()
80      .addCell("Alpha", "A1", "= #N/A")
81      .addExpectedValue("Alpha", "A1", new NAException())
82      .run();
83    runner()
84      .addCell("Alpha", "A1", "= #n/a")
85      .addExpectedValue("Alpha", "A1", new NAException())
86      .run();
87  });
88
89  it("should return ERROR error", function () {
90    runner()
91      .addCell("Alpha", "A1", "= #ERROR!")
92      .addExpectedValue("Alpha", "A1", new ParseException())
93      .run();
94    runner()
95      .addCell("Alpha", "A1", "= #error!")
96      .addExpectedValue("Alpha", "A1", new ParseException())
97      .run();
98  });
99});