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

Migrate election primary precinct split fixture to use generated version #5732

Merged
merged 18 commits into from
Dec 12, 2024
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
24 changes: 12 additions & 12 deletions apps/admin/backend/src/app.tally_report_data.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -531,20 +531,20 @@ test('multi language, filtered by ballot style - grouped by precinct ', async ()

expect(congressional1split1.cardCountsByParty).toEqual({
'0': {
bmd: 72,
hmpb: [],
bmd: 0,
hmpb: [72],
},
});
expect(congressional1split2.cardCountsByParty).toEqual({
'0': {
bmd: 72,
hmpb: [],
bmd: 0,
hmpb: [72],
},
});
expect(congressional2.cardCountsByParty).toEqual({
'1': {
bmd: 72,
hmpb: [],
bmd: 0,
hmpb: [72],
},
});
});
Expand Down Expand Up @@ -575,8 +575,8 @@ test('multi language, filtered by party - grouped by ballot style ', async () =>
assert(report.hasPartySplits);
expect(report.cardCountsByParty).toEqual({
'0': {
bmd: report.ballotStyleGroupId === '1-Ma' ? 144 : 72,
hmpb: [],
bmd: 0,
hmpb: [report.ballotStyleGroupId === '1-Ma' ? 144 : 72],
},
});
}
Expand Down Expand Up @@ -615,14 +615,14 @@ test('multi language, reports by ballot style - agnostic to language specific ba
assert(fourthFishTallyReport.hasPartySplits);
expect(firstMammalTallyReport.cardCountsByParty).toEqual({
'0': {
bmd: 144,
hmpb: [],
bmd: 0,
hmpb: [144],
},
});
expect(fourthFishTallyReport.cardCountsByParty).toEqual({
'1': {
bmd: 72,
hmpb: [],
bmd: 0,
hmpb: [72],
},
});
// contest lists should be different
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 3 additions & 10 deletions apps/design/backend/src/test_decks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ describe('createPrecinctTestDeck', () => {

test('for a precinct with multiple ballot styles', async () => {
const fixtures = primaryElectionFixtures;
const primaryElectionDefinition = (
await readElection(fixtures.electionPath)
).unsafeUnwrap();
const primaryElectionDefinition = fixtures.electionDefinition;
// Test takes unnecessarily long if using all language ballot styles
const electionDefinition: ElectionDefinition = {
...primaryElectionDefinition,
Expand Down Expand Up @@ -175,10 +173,7 @@ describe('getTallyReportResults', () => {
});

test('primary', async () => {
const fixtures = primaryElectionFixtures;
const electionDefinition = (
await readElection(fixtures.electionPath)
).unsafeUnwrap();
const { electionDefinition } = primaryElectionFixtures;
const { election } = electionDefinition;

const tallyReportResults = await getTallyReportResults(election);
Expand Down Expand Up @@ -242,7 +237,5 @@ test('createTestDeckTallyReport', async () => {
generatedAtTime: new Date('2021-01-01T00:00:00.000'),
});

await expect(reportDocumentBuffer).toMatchPdfSnapshot({
failureThreshold: 0.0001,
});
await expect(reportDocumentBuffer).toMatchPdfSnapshot();
});
7 changes: 2 additions & 5 deletions libs/ballot-interpreter/src/interpret_vx_hmpb.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -387,11 +387,8 @@ for (const spec of generalElectionFixtures.fixtureSpecs) {
}

describe('HMPB - primary election', () => {
const { electionPath, mammalParty, fishParty } = primaryElectionFixtures;
let electionDefinition: ElectionDefinition;
beforeAll(async () => {
electionDefinition = (await readElection(electionPath)).unsafeUnwrap();
});
const { electionDefinition, mammalParty, fishParty } =
primaryElectionFixtures;

for (const [partyLabel, partyFixtures] of Object.entries({
mammalParty,
Expand Down
2 changes: 1 addition & 1 deletion libs/fixture-generators/bin/generate-cvr-fixtures
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ rm -rf ../fixtures/data/electionTwoPartyPrimary/castVoteRecords/machine_0000__20
./bin/generate-cvrs --electionDefinition ../fixtures/data/electionTwoPartyPrimary/election.json --outputPath ../fixtures/data/electionTwoPartyPrimary/castVoteRecords/machine_0000__2024-01-01_00-00-00

rm -rf ../fixtures/data/electionPrimaryPrecinctSplits/castVoteRecords/machine_0000__2024-01-01_00-00-00
./bin/generate-cvrs --electionDefinition ../fixtures/data/electionPrimaryPrecinctSplits/election.json --outputPath ../fixtures/data/electionPrimaryPrecinctSplits/castVoteRecords/machine_0000__2024-01-01_00-00-00
./bin/generate-cvrs --electionDefinition ../fixtures/data/electionPrimaryPrecinctSplits/electionGeneratedWithGridLayoutsMultiLang.json --outputPath ../fixtures/data/electionPrimaryPrecinctSplits/castVoteRecords/machine_0000__2024-01-01_00-00-00

echo
echo "Note: You need to run \`pnpm build:resources && pnpm build\` in libs/fixtures for the new fixtures to register"
3 changes: 1 addition & 2 deletions libs/fixture-generators/src/generate-cvrs/generate_cvrs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,7 @@ export function* generateCvrs({
const { ballotStyles } = election;

// Currently we can generate only BMD ballots for non-gridLayouts elections.
// For gridLayouts elections we can generate BMD ballots although it would
// not be realistic since they cannot currently be scanned.
// For gridLayouts elections we just generate HMPB ballots for simplicity but could generated BMD.
const bmdBallots = Boolean(!election.gridLayouts);

for (const ballotStyle of ballotStyles) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ describe('fixtures are up to date - run `pnpm generate-election-packages` if thi

const baseElection =
electionPrimaryPrecinctSplitsFixtures.baseElection_DEPRECATED.election;
const electionFileContents =
electionPrimaryPrecinctSplitsFixtures.electionPackageExport.asBuffer();
const result = await readElectionPackageFromBuffer(electionFileContents);
assert(result.isOk());
const { electionPackage } = result.ok();
const { electionPackage } = (
await readElectionPackageFromBuffer(
electionPrimaryPrecinctSplitsFixtures.electionPackage.asBuffer()
)
).unsafeUnwrap();

const translator = new GoogleCloudTranslatorWithElectionCache({
translationClient: mockTranslationClient,
Expand Down
2 changes: 2 additions & 0 deletions libs/fixtures/.prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
/**/castVoteRecords/generated
/data/**/castVoteRecords/
/**/electionGenerated*.json
Binary file not shown.

This file was deleted.

Loading