-
Couldn't load subscription status.
- Fork 411
fix test runner #5069
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
pd-redis
wants to merge
13
commits into
playground
Choose a base branch
from
fe/bugfix/fix-test-runner
base: playground
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
fix test runner #5069
Changes from 5 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
3e8f163
update ts and msw
pd-redis 6f5d8e9
update msw mocks
pd-redis 4bedf1e
update jest config to work with msw 2
pd-redis 232e78a
fix msw calls
pd-redis 0798f5f
fix msw calls
pd-redis bc911cb
fix msw calls
pd-redis 8638485
use simpler solution for blob reader (#5105)
ArtemHoruzhenko 967d678
mock File for jest
pd-redis 6124698
fix tests
pd-redis 19bafbf
fix SavedQueriesScreen.spec.tsx by changing jest-environment
pd-redis dddf509
fix init.spec.ts to reflect error from axios
pd-redis a88ab77
fix instancesHandlers
pd-redis 6fba2c6
RI-7676: fix msw unhandled requests causing libuv error (#5111)
ArtemHoruzhenko File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 6 additions & 5 deletions
11
redisinsight/ui/src/mocks/handlers/analytics/dbAnalysisHistoryHandlers.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,7 @@ | ||
| import { DefaultBodyType, MockedRequest, RestHandler } from 'msw' | ||
| import { HttpHandler } from 'msw' | ||
|
|
||
| import clusterDetails from './clusterDetailsHandlers' | ||
| import dbAnalysisHistory from './dbAnalysisHistoryHandlers' | ||
|
|
||
| const handlers: RestHandler<MockedRequest<DefaultBodyType>>[] = [].concat( | ||
| clusterDetails, | ||
| dbAnalysisHistory, | ||
| ) | ||
| const handlers: HttpHandler[] = [...clusterDetails, ...dbAnalysisHistory] | ||
| export default handlers |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,8 @@ | ||
| import { DefaultBodyType, MockedRequest, RestHandler } from 'msw' | ||
| import { HttpHandler } from 'msw' | ||
|
|
||
| import info from './infoHandlers' | ||
| import telemetry from './telemetryHandlers' | ||
| import featureHandlers from './featureHandlers' | ||
|
|
||
| const handlers: RestHandler<MockedRequest<DefaultBodyType>>[] = [].concat( | ||
| info, | ||
| telemetry, | ||
| featureHandlers, | ||
| ) | ||
| const handlers: HttpHandler[] = [...info, ...telemetry, ...featureHandlers] | ||
| export default handlers |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 8 additions & 10 deletions
18
redisinsight/ui/src/mocks/handlers/app/telemetryHandlers.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,16 @@ | ||
| import { rest, RestHandler } from 'msw' | ||
| import { http, HttpHandler, HttpResponse } from 'msw' | ||
| import { ApiEndpoints } from 'uiSrc/constants' | ||
| import { getMswURL } from 'uiSrc/utils/test-utils' | ||
|
|
||
| const handlers: RestHandler[] = [ | ||
| const handlers: HttpHandler[] = [ | ||
| // sendEventTelemetry | ||
| rest.post( | ||
| getMswURL(ApiEndpoints.ANALYTICS_SEND_EVENT), | ||
| async (req, res, ctx) => res(ctx.status(200)), | ||
| ), | ||
| http.post(getMswURL(ApiEndpoints.ANALYTICS_SEND_EVENT), async () => { | ||
| return HttpResponse.text('', { status: 200 }) | ||
| }), | ||
| // sendPageViewTelemetry | ||
| rest.post( | ||
| getMswURL(ApiEndpoints.ANALYTICS_SEND_PAGE), | ||
| async (req, res, ctx) => res(ctx.status(200)), | ||
| ), | ||
| http.post(getMswURL(ApiEndpoints.ANALYTICS_SEND_PAGE), async () => { | ||
| return HttpResponse.text('', { status: 200 }) | ||
| }), | ||
| ] | ||
|
|
||
| export default handlers |
13 changes: 8 additions & 5 deletions
13
redisinsight/ui/src/mocks/handlers/browser/bulkActionsHandlers.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,7 @@ | ||
| import { DefaultBodyType, MockedRequest, RestHandler } from 'msw' | ||
| import { HttpHandler } from 'msw' | ||
|
|
||
| import redisearch from './redisearchHandlers' | ||
| import bulkActions from './bulkActionsHandlers' | ||
|
|
||
| const handlers: RestHandler<MockedRequest<DefaultBodyType>>[] = [].concat( | ||
| redisearch, | ||
| bulkActions, | ||
| ) | ||
| const handlers: HttpHandler[] = [...redisearch, ...bulkActions] | ||
| export default handlers |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,5 @@ | ||
| import { DefaultBodyType, MockedRequest, RestHandler } from 'msw' | ||
|
|
||
| import { HttpHandler } from 'msw' | ||
| import crb from './createRedisButtonsHandlers' | ||
|
|
||
| const handlers: RestHandler<MockedRequest>[] = [].concat(crb) | ||
| const handlers: HttpHandler[] = [...crb] | ||
| export default handlers |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the
http.getcall, I'm a bit confused about the generic types. From what I understand about MSW's type signature, the generics are<PathParams, ResponseBodyType, RequestBodyType>. So:Path params (
any)Since we're not using any path parameters in this URL pattern, could we use
Record<string, never>or just omit it instead ofany?Response body type (
DatabaseInstanceResponse[])We're actually returning
CLUSTER_DETAILS_DATA_MOCKwhich is typed asClusterDetails(a single object, not an array). Shouldn't this be:Or the
ClusterDetailsinterface is actually a subset ofDatabaseInstanceResponse, and it's fine.When I remove these type parameters entirely, I don't see any TypeScript errors. Are these types actually being validated somewhere, or are they more for documentation purposes? Maybe I'm missing some context about how MSW uses these in the testing setup?
I'm just trying to make sure I understand the pattern correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since this is purely test code, and TS types have no effect on actual results, I am in favor of omitting them overall