Skip to content

Commit

Permalink
fix: type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
wzhudev committed Oct 14, 2024
1 parent 6fae260 commit 6de288c
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/sheets-filter-ui/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"outDir": "lib/types"
},
"references": [{ "path": "./tsconfig.node.json" }],
"include": ["src", "../sheets-filter/src/commands/commands/sheets-filter.command.ts"]
"include": ["src"]
}
3 changes: 2 additions & 1 deletion packages/sheets-formula/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
],
"exports": {
".": "./src/index.ts",
"./*": "./src/*"
"./*": "./src/*",
"./facade": "./src/facade/index.ts"
},
"main": "./lib/cjs/index.js",
"module": "./lib/es/index.js",
Expand Down
1 change: 1 addition & 0 deletions packages/sheets-formula/src/facade/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
* limitations under the License.
*/

import './f-univer';
2 changes: 1 addition & 1 deletion packages/sheets-formula/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"outDir": "lib/types"
},
"references": [{ "path": "./tsconfig.node.json" }],
"include": ["src", "../sheets/src/services/ref-selections.service.ts"]
"include": ["src"]
}
2 changes: 1 addition & 1 deletion packages/sheets-hyper-link/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"outDir": "lib/types"
},
"references": [{ "path": "./tsconfig.node.json" }],
"include": ["src", "../sheets-hyper-link-ui/src/facade"]
"include": ["src"]
}
84 changes: 84 additions & 0 deletions packages/sheets/src/facade/__tests__/utils.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/**
* Copyright 2023-present DreamNum Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { describe, expect, it } from 'vitest';
import { covertCellValue, covertCellValues } from '../utils';

describe('Test utils', () => {
it('function covertCellValue', () => {
expect(covertCellValue('=SUM(1)')).toStrictEqual({ f: '=SUM(1)' });

expect(covertCellValue('1')).toStrictEqual({ v: '1' });
expect(covertCellValue(1)).toStrictEqual({ v: 1 });
expect(covertCellValue(true)).toStrictEqual({ v: true });

expect(covertCellValue({})).toStrictEqual({});
});

it('function covertCellValues', () => {
expect(
covertCellValues(
[
[1, 2],
[3, 4],
],
{ startRow: 1, startColumn: 1, endRow: 2, endColumn: 2 }
)
).toStrictEqual({
1: { 1: { v: 1 }, 2: { v: 2 } },
2: { 1: { v: 3 }, 2: { v: 4 } },
});

expect(
covertCellValues(
{
1: { 1: 1, 2: 2 },
2: { 1: 3, 2: 4 },
},
{ startRow: 1, startColumn: 1, endRow: 2, endColumn: 2 }
)
).toStrictEqual({
1: { 1: { v: 1 }, 2: { v: 2 } },
2: { 1: { v: 3 }, 2: { v: 4 } },
});

expect(
covertCellValues(
[
[{ v: 1 }, { v: 2 }],
[{ v: 3 }, { v: 4 }],
],
{ startRow: 1, startColumn: 1, endRow: 2, endColumn: 2 }
)
).toStrictEqual({
1: { 1: { v: 1 }, 2: { v: 2 } },
2: { 1: { v: 3 }, 2: { v: 4 } },
});

expect(
covertCellValues(
{
1: { 1: { v: 1 }, 2: { v: 2 } },
2: { 1: { v: 3 }, 2: { v: 4 } },
},
{ startRow: 1, startColumn: 1, endRow: 2, endColumn: 2 }
)
).toStrictEqual({
1: { 1: { v: 1 }, 2: { v: 2 } },
2: { 1: { v: 3 }, 2: { v: 4 } },
});
});
});
File renamed without changes.

0 comments on commit 6de288c

Please sign in to comment.