Skip to content

feat(Codecov): Add tests for datePicker components #89341

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

Merged
merged 6 commits into from
Apr 14, 2025

Conversation

adrian-codecov
Copy link
Contributor

Adds tests for the components in #89117. It also moves around those components for better folder structure.

@adrian-codecov adrian-codecov requested a review from a team as a code owner April 10, 2025 20:29
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Apr 10, 2025
Comment on lines 32 to 38
ConfigStore.loadInitialData(
ConfigFixture({
user: UserFixture({
options: {...UserFixture().options, timezone: 'America/New_York'},
}),
})
);
Copy link
Member

Choose a reason for hiding this comment

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

this can be simplified a bit

Suggested change
ConfigStore.loadInitialData(
ConfigFixture({
user: UserFixture({
options: {...UserFixture().options, timezone: 'America/New_York'},
}),
})
);
ConfigStore.set('user', UserFixture({timezone: 'America/New_York'}));

Copy link
Member

Choose a reason for hiding this comment

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

you probably don't need to setup the config store at all

Comment on lines 23 to 29
function getComponent(props = {}) {
return <DateSelector onChange={onChange} {...props} />;
}

function renderComponent(props = {}) {
return render(getComponent(props), {router});
}
Copy link
Member

@scttcper scttcper Apr 10, 2025

Choose a reason for hiding this comment

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

the props types here are {}. Putting <DateSelector onChange={onChange} /> in each test saves pain later

Comment on lines 10 to 18
const {router} = initializeOrg({
router: {
location: {
pathname: '/codecov/tests/',
query: {},
},
params: {},
},
});
Copy link
Member

Choose a reason for hiding this comment

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

you probably don't need this either

@adrian-codecov
Copy link
Contributor Author

Thanks for the feedback @scttcper, agree with your suggestions and got rid of some code

@adrian-codecov adrian-codecov enabled auto-merge (squash) April 14, 2025 18:51
Copy link

codecov bot commented Apr 14, 2025

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
7395 1 7394 4
View the top 1 failed test(s) by shortest run time
EventSearch handles basic inputs for tags
Stack Traces | 5.09s run time
Error: thrown: "Exceeded timeout of 5000 ms for a test.
Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
    at .../issueDetails/streamline/eventSearch.spec.tsx:51:3
    at _dispatchDescribe (.../jest-circus/build/index.js:91:26)
    at describe (.../jest-circus/build/index.js:55:5)
    at Object.<anonymous> (.../issueDetails/streamline/eventSearch.spec.tsx:15:1)
    at Runtime._execModule (.../jest-runtime/build/index.js:1439:24)
    at Runtime._loadModule (.../jest-runtime/build/index.js:1022:12)
    at Runtime.requireModule (.../jest-runtime/build/index.js:882:12)
    at jestAdapter (.../build/legacy-code-todo-rewrite/jestAdapter.js:77:13)
    at processTicksAndRejections (node:internal/process/task_queues:105:5)
    at runTestInternal (.../jest-runner/build/runTest.js:367:16)
    at runTest (.../jest-runner/build/runTest.js:444:34)
    at Object.worker (.../jest-runner/build/testWorker.js:106:12)

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@adrian-codecov adrian-codecov merged commit ae6767e into master Apr 14, 2025
41 checks passed
@adrian-codecov adrian-codecov deleted the adrian-tests-add-date-picker-tests branch April 14, 2025 19:10
andrewshie-sentry pushed a commit that referenced this pull request Apr 22, 2025
Adds tests for the components in
#89117. It also moves around
those components for better folder structure.
Copy link

sentry-io bot commented Apr 22, 2025

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ Error: �[2mexpect(�[22m�[31mreceived�[39m�[2m).�[22mtoEqual�[2m(�[22m�[32mexpected�[39m�[2m) // deep equality�[22m Object.?(datePicker.spec.tsx) View Issue
  • ‼️ Error: �[2mexpect(�[22m�[31mreceived�[39m�[2m).�[22mtoEqual�[2m(�[22m�[32mexpected�[39m�[2m) // deep equality�[22m Object.?(datePicker.spec.tsx) View Issue

Did you find this useful? React with a 👍 or 👎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants