Skip to content

Cb 6265 Return front unit tests after migration#3338

Merged
Wroud merged 34 commits intodevelfrom
CB-6265-return-front-unit-tests-after-migration
Apr 14, 2025
Merged

Cb 6265 Return front unit tests after migration#3338
Wroud merged 34 commits intodevelfrom
CB-6265-return-front-unit-tests-after-migration

Conversation

@sergeyteleshev
Copy link
Copy Markdown
Contributor

No description provided.

SychevAndrey
SychevAndrey previously approved these changes Mar 25, 2025
Copy link
Copy Markdown
Contributor

@SychevAndrey SychevAndrey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍🏻

Comment thread webapp/packages/core-cli/configs/vitest.config.ts Outdated
Comment thread webapp/packages/core-cli/configs/vitest.config.ts Outdated
Comment thread webapp/packages/core-cli/configs/vitest.config.ts
Comment thread webapp/packages/core-cli/configs/vitest.config.ts Outdated
Comment thread webapp/packages/core-cli/configs/vitest.setup.ts Outdated
Comment thread webapp/packages/core-cli/src/dependency-validator/validateDependencies.ts Outdated
Comment thread webapp/packages/tsconfig/test.d.ts Outdated
@sergeyteleshev sergeyteleshev requested a review from Wroud March 31, 2025 11:27
Wroud
Wroud previously approved these changes Mar 31, 2025
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is useless; I deleted it. importLazyComponent is just a syntax sugar which has no logic to test

Comment on lines 9 to 19
export function timestampToDate(timestamp: number) {
return new Date(timestamp).toLocaleString();
return new Date(timestamp).toLocaleString('en-US', {
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
second: '2-digit',
hour12: false,
});
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert. This must be handled on the test's side. You are currently changing the behavior of the application

afterEach(() => {
function resetMocks() {
vi.clearAllTimers();
vi.useFakeTimers();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to use fake timers by default?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. Real-timers run in real-time. So it takes tests longer

If tests have timers, it is required to fake timers
If tests have no timers, there is no harm to performance or test run environment

These changes save you a few lines of code, so you don't need to mock it again and again, and they also save you from forgetting about mocking timers

Comment thread webapp/packages/core-utils/src/__mocks__/mockToLocaleString.ts Outdated
@Wroud Wroud merged commit 143cbb0 into devel Apr 14, 2025
3 of 5 checks passed
@Wroud Wroud deleted the CB-6265-return-front-unit-tests-after-migration branch April 14, 2025 10:48
sergeyteleshev added a commit that referenced this pull request Apr 14, 2025
sergeyteleshev added a commit that referenced this pull request Apr 14, 2025
kkapper pushed a commit to PlaidCloud/cloudbeaver that referenced this pull request Apr 18, 2025
* СB-6265 sets up vitest instead of jest

* CB-6265 gets back core-utils tests

* СB-6265 gets back react-testing-library tests

* СB-6265 gets back some tests from another plugins

* CB-6265 renames dist -> lib in each plugin + removes all jest from the repo

* CB-6265 disables watch mode so build can go on

* CB-6265 extends tests types for react-testing-library

* CB-6265 reverts dist->lib rename cause it contains other assets also

* CB-6265 moves setupFiles to the vitest.config.ts

* CB-6265 pr fixes

* CB-6265 fixes tests run for Windows

* CB-6265 removes global: true in config + uses jest-dom/vitest lib to have extended expect types

* CB-6565 removes unused deps

* СB-6265 improves performance of the test x10 times

* CB-6265 gets back renderInApp, fixes vitest setup reset config for mocks, cleans up

* CB-6265 reset -> restore all mocks

* CB-6265 fixes unit tests

* CB-6265 vitest.setup.ts cleanup

* CB-6265 timestamp to date shows military time both: on unix and windows (win tests fix)

* CB-6265 improves tests running (sequential run instead of parallel)

* CB-6265 cleanup

* CB-6265 eslint fix

* CB-6265 eslint fix 2

* CB-6265 reverts useCombined handler

* CB-6265 reverts some tests

* CB-6265 removes all redundant timer configs

* Merge branch 'devel' into CB-6265-return-front-unit-tests-after-migration

* CB-6265 pr fixes

* CB-6265 fixes time for windows

* CB-6265 removes default fake timers before each test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants