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/CodeExecutorGeneralErrorTest.ts
-rw-r--r--
2080
 1import { assert } from "chai";
 2import { it, describe } from "../testutils/TestUtils";
 3import { F7Exception } from "../../../main/js/errors/F7Exception";
 4import { F7ExceptionName } from "../../../main/js/errors/F7ExceptionName";
 5import { run } from "../testutils/TestUtils";
 6
 7describe("CodeExecutor - General Error Test", function () {
 8  it("should work with NULL error", function () {
 9    assert.deepEqual((run("#NULL!") as F7Exception).name, F7ExceptionName.NULL);
10    assert.deepEqual((run("#null!") as F7Exception).name, F7ExceptionName.NULL);
11  });
12
13  it("should work with DIV error", function () {
14    assert.deepEqual((run("#DIV/0!") as F7Exception).name, F7ExceptionName.DIV);
15    assert.deepEqual((run("#div/0!") as F7Exception).name, F7ExceptionName.DIV);
16  });
17
18  it("should work with VALUE error", function () {
19    assert.deepEqual((run("#VALUE!") as F7Exception).name, F7ExceptionName.VALUE);
20    assert.deepEqual((run("#value!") as F7Exception).name, F7ExceptionName.VALUE);
21  });
22
23  it("should work with REF error", function () {
24    assert.deepEqual((run("#REF!") as F7Exception).name, F7ExceptionName.REF);
25    assert.deepEqual((run("#ref!") as F7Exception).name, F7ExceptionName.REF);
26  });
27
28  it("should work with NAME error", function () {
29    assert.deepEqual((run("#NAME?") as F7Exception).name, F7ExceptionName.NAME);
30    assert.deepEqual((run("#name?") as F7Exception).name, F7ExceptionName.NAME);
31  });
32
33  it("should work with NUM error", function () {
34    assert.deepEqual((run("#NUM!") as F7Exception).name, F7ExceptionName.NUM);
35    assert.deepEqual((run("#num!") as F7Exception).name, F7ExceptionName.NUM);
36  });
37
38  it("should work with N/A error", function () {
39    assert.deepEqual((run("#N/A") as F7Exception).name, F7ExceptionName.NA);
40    assert.deepEqual((run("#n/a") as F7Exception).name, F7ExceptionName.NA);
41  });
42
43  it("should work with ERROR error", function () {
44    assert.deepEqual((run("#ERROR!") as F7Exception).name, F7ExceptionName.PARSE);
45    assert.deepEqual((run("#error!") as F7Exception).name, F7ExceptionName.PARSE);
46  });
47});