Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
chore: adjust the scope of test coverage (#2673)
白熱8f2b2102643c
diff --git a/common/shared/vite/index.js b/common/shared/vite/index.jsindex d561e6c5cb..590b6e0007 100644--- a/common/shared/vite/index.js+++ b/common/shared/vite/index.js@@ -81,6 +81,28 @@ function createViteConfig(overrideConfig, /** @type {IOptions} */ options) {reporter: ['html', 'json'],provider: 'custom',customProviderModule: require.resolve('@vitest/coverage-istanbul'),+ exclude: [+ 'coverage/**',+ 'dist/**',+ '**/[.]**',+ 'packages/*/test?(s)/**',+ '**/*.d.ts',+ '**/virtual:*',+ '**/__x00__*',+ '**/\x00*',+ 'cypress/**',+ 'test?(s)/**',+ 'test?(-*).?(c|m)[jt]s?(x)',+ '**/*{.,-}{test,spec}?(-d).?(c|m)[jt]s?(x)',+ '**/__test?(s)__/**',+ '**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*',+ '**/vitest.{workspace,projects}.[jt]s?(on)',+ '**/.{eslint,mocha,prettier}rc.{?(c|m)js,yml}',+ 'lib/**',+ 'src/locale/**',+ '**/*.stories.tsx',+ '**/__testing__/**',+ ],},},};diff --git a/packages/core/src/services/__test__/index.ts b/packages/core/src/services/__tests__/index.tssimilarity index 100%rename from packages/core/src/services/__test__/index.tsrename to packages/core/src/services/__tests__/index.tsdiff --git a/packages/core/src/services/__test__/permission.spec.ts b/packages/core/src/services/__tests__/permission.spec.tssimilarity index 100%rename from packages/core/src/services/__test__/permission.spec.tsrename to packages/core/src/services/__tests__/permission.spec.tsdiff --git a/packages/design/src/components/pager/__tests__/index.spec.tsx b/packages/design/src/components/pager/__tests__/index.spec.tsxnew file mode 100644index 0000000000..576ee1debb--- /dev/null+++ b/packages/design/src/components/pager/__tests__/index.spec.tsx@@ -0,0 +1,50 @@+/**+ * 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 { afterEach, describe, expect, it, vi } from 'vitest';+import React from 'react';+import { cleanup, render } from '@testing-library/react';+import type { IPagerProps } from '../Pager';+import { Pager } from '../Pager';++describe('Pager', () => {+ const defaultProps: IPagerProps = {+ value: 1,+ total: 5,+ onChange: vi.fn(),+ };++ // cleanup after each test+ afterEach(cleanup);++ it('renders correctly with default props', () => {+ const { getByText } = render(<Pager {...defaultProps} />);+ expect(getByText('1/5')).toBeTruthy();+ });++ it('renders correctly with custom text', () => {+ const props: IPagerProps = { ...defaultProps, text: 'Custom Text' };+ const { getByText } = render(<Pager {...props} />);+ expect(getByText('Custom Text')).toBeTruthy();+ });++ it('renders only text when total is 0', () => {+ const props: IPagerProps = { ...defaultProps, total: 0 };+ const { getByText, queryByRole } = render(<Pager {...props} />);+ expect(getByText('1/0')).toBeTruthy();+ expect(queryByRole('button')).not.toBeTruthy();+ });+});