Skip to content

Commit

Permalink
10409: more test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
JayFlexy committed Sep 23, 2024
1 parent 5dc7ace commit c38fe65
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
16 changes: 9 additions & 7 deletions web-client/src/presenter/computeds/trialSessionsHelper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,14 +262,19 @@ describe('trialSessionsHelper', () => {
describe('trialSessionRows', () => {
describe('filters', () => {
it('should filter trial sessions by judge', () => {
trialSession1.judge!.userId = '1';
trialSession2.judge!.userId = '2';
trialSession1.judge!.userId = '43b00e5f-b78c-476c-820e-5d6ed1d58828';
trialSession2.judge!.userId = 'd17b07dc-6455-447e-bea3-f91d12ac5a6';
trialSessionsPageState.trialSessions = [trialSession1, trialSession2];
trialSessionsPageState.filters.judgeId = '1';
trialSessionsPageState.filters.judges = {
'd17b07dc-6455-447e-bea3-f91d12ac5a6': {
name: 'Colvin',
userId: 'd17b07dc-6455-447e-bea3-f91d12ac5a6',
},
};

const result = runCompute(trialSessionsHelper, {
state: {
judges: [judgeUser],
judges: [judgeUser, judgeColvin],
permissions: getUserPermissions(docketClerk1User),
trialSessionsPage: trialSessionsPageState,
},
Expand Down Expand Up @@ -302,9 +307,6 @@ describe('trialSessionsHelper', () => {
);
});

// #ix this
// TODO: This test is affectd by pagination now. Ergo, one trial sessionis filtered out
// when it should not be base on this test
it('should not filter trial sessions by judge when judge filter is All', () => {
trialSessionsPageState.trialSessions = [trialSession1, trialSession2];
trialSessionsPageState.filters.judgeId = 'All';
Expand Down
5 changes: 4 additions & 1 deletion web-client/src/presenter/computeds/trialSessionsHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const trialSessionsHelper = (
const judge = get(state.judgeUser);
const judges = get(state.judges);

const pageSize = 1;
const pageSize = 5; // set this to sane value for testing purposes

const showCurrentJudgesOnly =
filters.currentTab === 'new' ||
Expand Down Expand Up @@ -79,6 +79,7 @@ export const trialSessionsHelper = (
label: sessionType,
value: sessionType,
}));

const trialSessionJudgeOptions = trialSessionJudges.map(
trialSessionJudge => ({
label: trialSessionJudge.name,
Expand All @@ -97,10 +98,12 @@ export const trialSessionsHelper = (
filters,
trialSessions,
});

const trialSessionPage = filteredTrialSessions.slice(
filters.pageNumber * pageSize,
filters.pageNumber * pageSize + pageSize,
);

const trialSessionRows = formatTrialSessions({
judgeAssociatedToUser: judge,
trialSessions: trialSessionPage,
Expand Down

0 comments on commit c38fe65

Please sign in to comment.