From b29574d5cb37be1614385c8f6b6c9c25717f6f70 Mon Sep 17 00:00:00 2001 From: wpxp123456 Date: Mon, 9 Sep 2024 20:54:43 +0800 Subject: [PATCH] fix(formula): fix codecov --- packages/engine-formula/src/functions/lookup/drop/index.ts | 4 ---- .../src/functions/lookup/expand/__tests__/index.spec.ts | 3 +++ .../src/functions/lookup/take/__tests__/index.spec.ts | 3 +++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/engine-formula/src/functions/lookup/drop/index.ts b/packages/engine-formula/src/functions/lookup/drop/index.ts index 68d25c649374..454d64e5ee31 100644 --- a/packages/engine-formula/src/functions/lookup/drop/index.ts +++ b/packages/engine-formula/src/functions/lookup/drop/index.ts @@ -132,10 +132,6 @@ export class Drop extends BaseFunction { } private _getResultArray(array: BaseValueObject, rows: number, columns: number, arrayRowCount: number, arrayColumnCount: number): BaseValueObject { - if (!array.isArray()) { - return array; - } - const rowParam = rows >= 0 ? [rows, arrayRowCount] : [0, arrayRowCount + rows]; const columnParam = columns >= 0 ? [columns, arrayColumnCount] : [0, arrayColumnCount + columns]; diff --git a/packages/engine-formula/src/functions/lookup/expand/__tests__/index.spec.ts b/packages/engine-formula/src/functions/lookup/expand/__tests__/index.spec.ts index e89fb7ca8f64..b60be7ee7e8e 100644 --- a/packages/engine-formula/src/functions/lookup/expand/__tests__/index.spec.ts +++ b/packages/engine-formula/src/functions/lookup/expand/__tests__/index.spec.ts @@ -90,6 +90,9 @@ describe('Test expand function', () => { [ErrorType.VALUE, ErrorType.VALUE], [ErrorType.VALUE, ErrorType.VALUE], ]); + + const result7 = testFunction.calculate(array2, rows, columns); + expect(getObjectValue(result7)).toStrictEqual(1); }); it('Rows value test', async () => { diff --git a/packages/engine-formula/src/functions/lookup/take/__tests__/index.spec.ts b/packages/engine-formula/src/functions/lookup/take/__tests__/index.spec.ts index 0fbec57a0b63..1c3cc3b3f955 100644 --- a/packages/engine-formula/src/functions/lookup/take/__tests__/index.spec.ts +++ b/packages/engine-formula/src/functions/lookup/take/__tests__/index.spec.ts @@ -94,6 +94,9 @@ describe('Test take function', () => { [ErrorType.VALUE, ErrorType.VALUE], [ErrorType.VALUE, ErrorType.VALUE], ]); + + const result7 = testFunction.calculate(array2, rows, columns); + expect(getObjectValue(result7)).toStrictEqual(1); }); it('Rows value test', async () => {