-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5630 from flexion/10293-design-debt-intermediate-…
…branch-to-test-1732629359 10293 to test: use unique React key in PendingReportList.tsx
- Loading branch information
Showing
15 changed files
with
145 additions
and
213 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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
99 changes: 0 additions & 99 deletions
99
web-client/src/presenter/computeds/formattedPendingItems.test.ts
This file was deleted.
Oops, something went wrong.
34 changes: 0 additions & 34 deletions
34
web-client/src/presenter/computeds/formattedPendingItems.ts
This file was deleted.
Oops, something went wrong.
35 changes: 35 additions & 0 deletions
35
web-client/src/presenter/computeds/pendingReportHelper.test.ts
This file contains 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,35 @@ | ||
import { cloneDeep } from 'lodash'; | ||
import { initialPendingReportsState } from '@web-client/presenter/state/pendingReportState'; | ||
import { pendingReportHelper as pendingReportComputed } from './pendingReportHelper'; | ||
import { runCompute } from '@web-client/presenter/test.cerebral'; | ||
import { withAppContextDecorator } from '../../withAppContext'; | ||
|
||
describe('pendingReportHelper', () => { | ||
const pendingReportHelper = withAppContextDecorator(pendingReportComputed); | ||
|
||
const pendingReportsState = cloneDeep(initialPendingReportsState); | ||
|
||
it('appends screenMetadata.pendingItemsFilters.judge on the printUrl if one is present', () => { | ||
const result = runCompute(pendingReportHelper, { | ||
state: { | ||
judges: [], | ||
pendingReports: pendingReportsState, | ||
screenMetadata: { pendingItemsFilters: { judge: 'Judge Somebody' } }, | ||
}, | ||
}); | ||
|
||
expect(result.printUrl).toContain('Judge%20Somebody'); | ||
}); | ||
|
||
it('returns default printUrl if screenMetadata.pendingItemsFilters.judge is not set', () => { | ||
const result = runCompute(pendingReportHelper, { | ||
state: { | ||
judges: [], | ||
pendingReports: pendingReportsState, | ||
screenMetadata: { pendingItemsFilters: {} }, | ||
}, | ||
}); | ||
|
||
expect(result.printUrl).toEqual('/reports/pending-report/printable?'); | ||
}); | ||
}); |
This file contains 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,16 @@ | ||
import { Get } from 'cerebral'; | ||
import { state } from '@web-client/presenter/app.cerebral'; | ||
import qs from 'qs'; | ||
|
||
export const pendingReportHelper = ( | ||
get: Get, | ||
): { | ||
printUrl: string; | ||
} => { | ||
const judgeFilter = get(state.screenMetadata.pendingItemsFilters.judge); | ||
const queryString = qs.stringify({ judgeFilter }); | ||
|
||
return { | ||
printUrl: `/reports/pending-report/printable?${queryString}`, | ||
}; | ||
}; |
Oops, something went wrong.