Skip to content

Commit

Permalink
:test: more test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
wangfengming committed Jun 22, 2020
1 parent 8c9b61b commit 057f41e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/file/table/table-row/table-row.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,9 @@ describe("TableRow", () => {
expect(tableRow.rootIndexToColumnIndex(2)).to.equal(3);
expect(tableRow.rootIndexToColumnIndex(3)).to.equal(4);
expect(tableRow.rootIndexToColumnIndex(4)).to.equal(5);

expect(() => tableRow.rootIndexToColumnIndex(0)).to.throw(`cell 'rootIndex' should between 1 to 4`);
expect(() => tableRow.rootIndexToColumnIndex(5)).to.throw(`cell 'rootIndex' should between 1 to 4`);
});
});

Expand Down Expand Up @@ -242,6 +245,9 @@ describe("TableRow", () => {
expect(tableRow.columnIndexToRootIndex(5)).to.equal(4);
expect(tableRow.columnIndexToRootIndex(6)).to.equal(4);
expect(tableRow.columnIndexToRootIndex(7)).to.equal(4);

expect(() => tableRow.columnIndexToRootIndex(-1)).to.throw(`cell 'columnIndex' should not less than zero`);
expect(() => tableRow.columnIndexToRootIndex(8)).to.throw(`cell 'columnIndex' should not great than 7`);
});

it("should allow end new cell index", () => {
Expand All @@ -264,7 +270,6 @@ describe("TableRow", () => {
],
});

expect(() => tableRow.columnIndexToRootIndex(8)).to.throw(`cell 'columnIndex' should not great than 7`);
expect(tableRow.columnIndexToRootIndex(8, true)).to.equal(5);
expect(() => tableRow.columnIndexToRootIndex(9, true)).to.throw(`cell 'columnIndex' should not great than 8`);
});
Expand Down

0 comments on commit 057f41e

Please sign in to comment.