-
Notifications
You must be signed in to change notification settings - Fork 210
Prod - April release #7206
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
Prod - April release #7206
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
d984edd
Update Trivy action to version 0.35.0
kkartunov c8377c6
PM-4609: include unscored MM submissions in the submissions tab
jmgasper fe4d298
Ignore isWiproAllowed flag on Topgear Tasks
jmgasper 4a00fd9
Merge branch 'develop' of github.com:topcoder-platform/community-app …
jmgasper bebcd7d
PM-4648 fixes
jmgasper f07a4b9
Fix failing test
jmgasper 0b57f80
PM-4662: fix MM provisional score display
jmgasper 6dd1e78
QA fixes for new WM
jmgasper e0dae54
PM-4648: hide task actions in challenge header
jmgasper 50c1a8f
PM-4608: show MM final scores during active review
jmgasper 1af50dc
Merge pull request #7193 from topcoder-platform/PM-4662
jmgasper 2d2af32
Merge pull request #7194 from topcoder-platform/PM-4648-1
jmgasper 0652d14
Merge develop into PM-4608
jmgasper 9c838e5
PM-4648: add missing task header regression coverage
jmgasper fff2051
Merge pull request #7196 from topcoder-platform/PM-4608
jmgasper d834b38
Merge pull request #7200 from topcoder-platform/PM-4648-3
jmgasper 470f33a
PM-4720 Update to v6
himaniraghav3 d45d0ed
Merge pull request #7204 from topcoder-platform/PM-4720
himaniraghav3 e1458ab
PM-4720 Fix page payload for copilots api
himaniraghav3 02eb3f1
Merge pull request #7205 from topcoder-platform/PM-4720
himaniraghav3 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
127 changes: 127 additions & 0 deletions
127
__tests__/shared/components/challenge-detail/Header/index.jsx
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 |
|---|---|---|
| @@ -0,0 +1,127 @@ | ||
| import React from 'react'; | ||
| import Renderer from 'react-test-renderer/shallow'; | ||
|
|
||
| import Header from 'components/challenge-detail/Header'; | ||
|
|
||
| function collectText(node) { | ||
| if (typeof node === 'string') { | ||
| return [node]; | ||
| } | ||
|
|
||
| if (!React.isValidElement(node)) { | ||
| return []; | ||
| } | ||
|
|
||
| return React.Children.toArray(node.props.children) | ||
| .reduce((acc, child) => acc.concat(collectText(child)), []); | ||
| } | ||
|
|
||
| function renderHeader(challengeOverrides = {}) { | ||
| const renderer = new Renderer(); | ||
| renderer.render( | ||
| <Header | ||
| challenge={{ | ||
| drPoints: null, | ||
| events: [], | ||
| funChallenge: false, | ||
| id: 'challenge-id', | ||
| legacy: {}, | ||
| metadata: [], | ||
| name: 'Challenge title', | ||
| numOfCheckpointSubmissions: 0, | ||
| numOfRegistrants: 0, | ||
| numOfSubmissions: 0, | ||
| phases: [ | ||
| { | ||
| isOpen: true, | ||
| name: 'Registration', | ||
| scheduledEndDate: '2030-01-02T00:00:00.000Z', | ||
| scheduledStartDate: '2030-01-01T00:00:00.000Z', | ||
| }, | ||
| ], | ||
| pointPrizes: [], | ||
| prizeSets: [ | ||
| { | ||
| type: 'placement', | ||
| prizes: [{ type: 'USD', value: 1000 }], | ||
| }, | ||
| ], | ||
| reliabilityBonus: 0, | ||
| skills: [], | ||
| status: 'ACTIVE', | ||
| tags: [], | ||
| track: 'Development', | ||
| type: 'Challenge', | ||
| ...challengeOverrides, | ||
| }} | ||
| challengeTypesMap={{}} | ||
| challengesUrl="/challenges" | ||
| checkpoints={{}} | ||
| hasFirstPlacement={false} | ||
| hasRecommendedChallenges={false} | ||
| hasRegistered={false} | ||
| hasThriveArticles={false} | ||
| isLoggedIn | ||
| mySubmissions={[]} | ||
| numWinners={1} | ||
| onSelectorClicked={jest.fn()} | ||
| onSort={jest.fn()} | ||
| onToggleDeadlines={jest.fn()} | ||
| openForRegistrationChallenges={{}} | ||
| registerForChallenge={jest.fn()} | ||
| registering={false} | ||
| selectedView="details" | ||
| setChallengeListingFilter={jest.fn()} | ||
| showDeadlineDetail={false} | ||
| submissionEnded={false} | ||
| unregisterFromChallenge={jest.fn()} | ||
| unregistering={false} | ||
| viewAsTable={false} | ||
| />, | ||
| ); | ||
|
|
||
| return renderer.getRenderOutput(); | ||
| } | ||
|
|
||
| describe('Challenge detail header actions', () => { | ||
| test('hides registration and submission actions for classic task challenges', () => { | ||
| const output = renderHeader({ | ||
| type: 'Task', | ||
| }); | ||
|
|
||
| expect(collectText(output)).not.toContain('Register'); | ||
| expect(collectText(output)).not.toContain('Unregister'); | ||
| expect(collectText(output)).not.toContain('Submit a solution'); | ||
| }); | ||
|
|
||
| test('hides registration and submission actions for work-app task payloads', () => { | ||
| const output = renderHeader({ | ||
| task: { | ||
| isTask: true, | ||
| }, | ||
| }); | ||
|
|
||
| expect(collectText(output)).not.toContain('Register'); | ||
| expect(collectText(output)).not.toContain('Unregister'); | ||
| expect(collectText(output)).not.toContain('Submit a solution'); | ||
| }); | ||
|
|
||
| test('hides registration and submission actions for pure v5 task payloads', () => { | ||
| const output = renderHeader({ | ||
| legacy: { | ||
| pureV5Task: true, | ||
| }, | ||
| }); | ||
|
|
||
| expect(collectText(output)).not.toContain('Register'); | ||
| expect(collectText(output)).not.toContain('Unregister'); | ||
| expect(collectText(output)).not.toContain('Submit a solution'); | ||
| }); | ||
|
|
||
| test('shows registration and submission actions for non-task challenges', () => { | ||
| const output = renderHeader(); | ||
|
|
||
| expect(collectText(output)).toContain('Register'); | ||
| expect(collectText(output)).toContain('Submit a solution'); | ||
| }); | ||
| }); |
47 changes: 47 additions & 0 deletions
47
__tests__/shared/components/challenge-detail/MySubmissions/SubmissionsList/index.jsx
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 |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| import { getDisplayedScores } from '../../../../../../src/shared/components/challenge-detail/MySubmissions/SubmissionsList'; | ||
|
|
||
| describe('getDisplayedScores', () => { | ||
| test('shows final scores when a system review already produced one before review completes', () => { | ||
| expect(getDisplayedScores( | ||
| { | ||
| finalScore: 100, | ||
| initialScore: 100, | ||
| provisionalScore: 0, | ||
| }, | ||
| { | ||
| phases: [ | ||
| { | ||
| isOpen: true, | ||
| name: 'Registration', | ||
| scheduledStartDate: '2030-01-01T00:00:00.000Z', | ||
| }, | ||
| ], | ||
| }, | ||
| )).toEqual({ | ||
| finalScore: 100, | ||
| provisionalScore: 100, | ||
| }); | ||
| }); | ||
|
|
||
| test('shows final scores once the review phase is complete', () => { | ||
| expect(getDisplayedScores( | ||
| { | ||
| finalScore: 100, | ||
| initialScore: 95, | ||
| provisionalScore: 0, | ||
| }, | ||
| { | ||
| phases: [ | ||
| { | ||
| isOpen: false, | ||
| name: 'Review', | ||
| scheduledStartDate: '2000-01-01T00:00:00.000Z', | ||
| }, | ||
| ], | ||
| }, | ||
| )).toEqual({ | ||
| finalScore: 100, | ||
| provisionalScore: 95, | ||
| }); | ||
| }); | ||
| }); | ||
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
59 changes: 59 additions & 0 deletions
59
__tests__/shared/utils/challenge-detail/mm-final-results.test.js
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 |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| /* eslint-env jest */ | ||
| import { | ||
| hasVisibleMmFinalResults, | ||
| isReviewPhaseComplete, | ||
| shouldShowFinalMmResults, | ||
| } from '../../../../src/shared/utils/challenge-detail/mm-final-results'; | ||
|
|
||
| describe('mm-final-results utilities', () => { | ||
| const activeReviewChallenge = { | ||
| phases: [ | ||
| { | ||
| isOpen: true, | ||
| name: 'Review', | ||
| scheduledStartDate: '2030-01-01T00:00:00.000Z', | ||
| }, | ||
| ], | ||
| }; | ||
|
|
||
| it('detects when the review phase has completed', () => { | ||
| expect(isReviewPhaseComplete({ | ||
| phases: [ | ||
| { | ||
| isOpen: false, | ||
| name: 'Review', | ||
| scheduledStartDate: '2000-01-01T00:00:00.000Z', | ||
| }, | ||
| ], | ||
| })).toBe(true); | ||
| }); | ||
|
|
||
| it('keeps final Marathon Match results hidden while review is active and no final score exists', () => { | ||
| expect(shouldShowFinalMmResults(activeReviewChallenge, [ | ||
| { | ||
| finalRank: null, | ||
| submissions: [ | ||
| { | ||
| finalScore: null, | ||
| }, | ||
| ], | ||
| }, | ||
| ])).toBe(false); | ||
| }); | ||
|
|
||
| it('shows final Marathon Match results as soon as a final score is available', () => { | ||
| const mmSubmissions = [ | ||
| { | ||
| finalRank: 1, | ||
| submissions: [ | ||
| { | ||
| finalScore: 100, | ||
| }, | ||
| ], | ||
| }, | ||
| ]; | ||
|
|
||
| expect(hasVisibleMmFinalResults(mmSubmissions)).toBe(true); | ||
| expect(shouldShowFinalMmResults(activeReviewChallenge, mmSubmissions)).toBe(true); | ||
| }); | ||
| }); |
70 changes: 70 additions & 0 deletions
70
__tests__/shared/utils/challenge-detail/my-submission-scores.test.js
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 |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| /* eslint-env jest */ | ||
| import { getDisplayedScores } from '../../../../src/shared/components/challenge-detail/MySubmissions/SubmissionsList'; | ||
|
|
||
| describe('getDisplayedScores', () => { | ||
| it('shows final scores when a system review has already produced one', () => { | ||
| expect(getDisplayedScores( | ||
| { | ||
| finalScore: 100, | ||
| initialScore: 100, | ||
| provisionalScore: 0, | ||
| }, | ||
| { | ||
| phases: [ | ||
| { | ||
| isOpen: true, | ||
| name: 'Registration', | ||
| scheduledStartDate: '2030-01-01T00:00:00.000Z', | ||
| }, | ||
| ], | ||
| }, | ||
| )).toEqual({ | ||
| finalScore: 100, | ||
| provisionalScore: 100, | ||
| }); | ||
| }); | ||
|
|
||
| it('hides final scores while review is active and no final result exists yet', () => { | ||
| expect(getDisplayedScores( | ||
| { | ||
| finalScore: null, | ||
| initialScore: 95, | ||
| provisionalScore: 0, | ||
| }, | ||
| { | ||
| phases: [ | ||
| { | ||
| isOpen: true, | ||
| name: 'Registration', | ||
| scheduledStartDate: '2030-01-01T00:00:00.000Z', | ||
| }, | ||
| ], | ||
| }, | ||
| )).toEqual({ | ||
| finalScore: null, | ||
| provisionalScore: 95, | ||
| }); | ||
| }); | ||
|
|
||
| it('shows final scores once the review phase is complete', () => { | ||
| expect(getDisplayedScores( | ||
| { | ||
| finalScore: 100, | ||
| initialScore: 95, | ||
| provisionalScore: 0, | ||
| }, | ||
| { | ||
| phases: [ | ||
| { | ||
| isOpen: false, | ||
| name: 'Review', | ||
| scheduledStartDate: '2000-01-01T00:00:00.000Z', | ||
| }, | ||
| ], | ||
| }, | ||
| )).toEqual({ | ||
| finalScore: 100, | ||
| provisionalScore: 95, | ||
| }); | ||
| }); | ||
| }); |
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.
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.
This test file duplicates the
getDisplayedScorescoverage already added in__tests__/shared/utils/challenge-detail/my-submission-scores.test.js(and the utils test is more complete). To avoid redundant test maintenance and slower runs, consider removing this duplicate suite or consolidating the unique assertions into a single location.