Skip to content

Commit

Permalink
10409: WIP Add pagesize, fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Zachary Rogers committed Sep 24, 2024
1 parent 24cd260 commit 10708a2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 14 deletions.
33 changes: 21 additions & 12 deletions web-client/src/presenter/computeds/trialSessionsHelper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ describe('trialSessionsHelper', () => {
});
});

describe('showUnassignedJudgeFilter', () => {
describe('trialSessionJudgeOptions', () => {
it('should show the `unassigned` judge filter when on the new tab', () => {
trialSessionsPageState.filters.currentTab = 'new';

Expand All @@ -137,10 +137,13 @@ describe('trialSessionsHelper', () => {
},
});

expect(result.showUnassignedJudgeFilter).toBeTruthy();
expect(result.trialSessionJudgeOptions[2]).toEqual({
label: 'Unassigned',
value: { name: 'Unassigned', userId: 'unassigned' },
});
});

it('should show the `unassigned` judge filter when on the calendared tab', () => {
it('should not show the `unassigned` judge filter when on the calendared tab', () => {
trialSessionsPageState.filters.currentTab = 'calendared';

const result = runCompute(trialSessionsHelper, {
Expand All @@ -151,7 +154,7 @@ describe('trialSessionsHelper', () => {
},
});

expect(result.showUnassignedJudgeFilter).toEqual(false);
expect(result.trialSessionJudgeOptions.length).toEqual(2);
});
});

Expand Down Expand Up @@ -197,15 +200,21 @@ describe('trialSessionsHelper', () => {
},
});

expect(result.trialSessionJudgeOptions).toEqual([
{
label: 'Sotomayor',
value: {
name: 'Sotomayor',
userId: '43b00e5f-b78c-476c-820e-5d6ed1d58828',
},
expect(result.trialSessionJudgeOptions).toContain({
label: judgeUser.name,
value: {
name: judgeUser.name,
userId: judgeUser.userId,
},
]);
});

expect(result.trialSessionJudgeOptions).not.toContain({
label: legacyJudgeUser.name,
value: {
name: legacyJudgeUser.name,
userId: legacyJudgeUser.userId,
},
});
});

it('returns only current judges when the session status is open', () => {
Expand Down
4 changes: 2 additions & 2 deletions web-client/src/presenter/computeds/trialSessionsHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ export const trialSessionsHelper = (
const judge = get(state.judgeUser);
const judges = get(state.judges);

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

const showCurrentJudgesOnly =
filters.currentTab === 'new' ||
filters.sessionStatus === SESSION_STATUS_TYPES.open;

let trialSessionJudges: { name: string; userId: string }[]; // 10409 TODO BUG. The judge options is not updating correctly. Showing legacy when it should not.
let trialSessionJudges: { name: string; userId: string }[];
if (showCurrentJudgesOnly) {
trialSessionJudges = judges;
} else {
Expand Down

0 comments on commit 10708a2

Please sign in to comment.