Skip to content
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

feat(admin): Reports Screen Content Revamp #4028

Merged
merged 7 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/admin/frontend/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ export const getCardCounts = {
return input ? ['getCardCounts', input] : ['getCardCounts'];
},
useQuery(
input: GetCardCountsInput = { groupBy: {} },
input: GetCardCountsInput = {},
options: { enabled: boolean } = { enabled: true }
) {
const apiClient = useApiClient();
Expand Down
27 changes: 14 additions & 13 deletions apps/admin/frontend/src/app.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ import { eitherNeitherElectionDefinition } from '../test/render_in_app_context';
import { VxFiles } from './lib/converters';
import { buildApp } from '../test/helpers/build_app';
import { ApiMock, createApiMock } from '../test/helpers/mock_api_client';
import { expectReportsScreenCardCountQueries } from '../test/helpers/api_expect_helpers';

import { mockCastVoteRecordFileRecord } from '../test/api_mock_data';
import { getSimpleMockTallyResults } from '../test/helpers/mock_results';
import {
getMockCardCounts,
getSimpleMockTallyResults,
} from '../test/helpers/mock_results';

jest.mock('@votingworks/ballot-encoder', () => {
return {
Expand Down Expand Up @@ -333,23 +335,24 @@ test('marking results as official', async () => {
electionDefinition,
});
apiMock.expectGetCastVoteRecordFileMode('official');
apiMock.expectGetResultsForTallyReports({ filter: {} }, [
apiMock.expectGetResultsForTallyReports({ filter: {}, groupBy: {} }, [
getSimpleMockTallyResults({
election,
scannedBallotCount: 100,
cardCountsByParty: {},
}),
]);
apiMock.expectGetScannerBatches([]);
apiMock.expectGetManualResultsMetadata([]);
expectReportsScreenCardCountQueries({ apiMock, isPrimary: true });
apiMock.expectGetCardCounts({}, [getMockCardCounts(0)]);
renderApp();

await apiMock.authenticateAsElectionManager(electionDefinition);

userEvent.click(screen.getButton('Reports'));
userEvent.click(screen.getButton('Unofficial Full Election Tally Report'));
await screen.findByText('Unofficial Example Primary Election Tally Report');
userEvent.click(screen.getButton('Full Election Tally Report'));
await screen.findByText(
'Unofficial Mammal Party Example Primary Election Tally Report'
);

apiMock.expectMarkResultsOfficial();
apiMock.expectGetCurrentElectionMetadata({
Expand All @@ -365,7 +368,9 @@ test('marking results as official', async () => {
'Mark Tally Results as Official'
)
);
await screen.findByText('Official Example Primary Election Tally Report');
await screen.findByText(
'Official Mammal Party Example Primary Election Tally Report'
);
});

test('removing election resets cvr and manual data files', async () => {
Expand Down Expand Up @@ -486,11 +491,7 @@ test('election manager UI has expected nav', async () => {
apiMock.expectGetCastVoteRecordFileMode('unlocked');
apiMock.expectGetCastVoteRecordFiles([]);
apiMock.expectGetManualResultsMetadata([]);
expectReportsScreenCardCountQueries({
apiMock,
isPrimary: false,
});
apiMock.expectGetScannerBatches([]);
apiMock.expectGetCardCounts({}, [getMockCardCounts(100)]);
renderApp();
await apiMock.authenticateAsElectionManager(eitherNeitherElectionDefinition);

Expand Down
Loading