Skip to content

Commit

Permalink
fix(formula): add serializeRangeToRefString test case
Browse files Browse the repository at this point in the history
  • Loading branch information
Dushusir committed Dec 2, 2024
1 parent 11ea062 commit 2e66dc0
Showing 1 changed file with 52 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,19 @@ describe('Test Reference', () => {
});

it('serializeRangeToRefString', () => {
expect(
serializeRangeToRefString({
range: {
startColumn: 0,
endColumn: 10,
startRow: 5,
endRow: 10,
rangeType: RANGE_TYPE.COLUMN,
},
sheetName: '',
unitId: '',
})
).toEqual('A:K');
expect(
serializeRangeToRefString({
range: {
Expand Down Expand Up @@ -140,6 +153,45 @@ describe('Test Reference', () => {
unitId: 'workbook-1',
})
).toEqual("'[workbook-1]sheet1'!16:16");
expect(
serializeRangeToRefString({
range: {
startColumn: Number.NaN,
endColumn: Number.NaN,
startRow: 15,
endRow: 15,
rangeType: RANGE_TYPE.ROW,
},
sheetName: "sheet'1",
unitId: '',
})
).toEqual("'sheet''1'!16:16");
expect(
serializeRangeToRefString({
range: {
startColumn: Number.NaN,
endColumn: Number.NaN,
startRow: 15,
endRow: 15,
rangeType: RANGE_TYPE.ROW,
},
sheetName: "sheet''1",
unitId: '',
})
).toEqual("'sheet''''1'!16:16");
expect(
serializeRangeToRefString({
range: {
startColumn: Number.NaN,
endColumn: Number.NaN,
startRow: 15,
endRow: 15,
rangeType: RANGE_TYPE.ROW,
},
sheetName: "sheet'1",
unitId: 'workbook-1',
})
).toEqual("'[workbook-1]sheet''1'!16:16");
});

it('deserializeRangeWithSheet', () => {
Expand Down

0 comments on commit 2e66dc0

Please sign in to comment.