-
Notifications
You must be signed in to change notification settings - Fork 103
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
Fix floating point errors in PDFs #717
Fix floating point errors in PDFs #717
Conversation
A file downloader implementation is going to vary between desktop, web, and test implementations. So I've refactored components that include downloading a PDF to allow this dependency to be injected.
Codecov Report
@@ Coverage Diff @@
## master #717 +/- ##
==========================================
+ Coverage 65.51% 69.94% +4.43%
==========================================
Files 112 113 +1
Lines 3744 3767 +23
Branches 581 584 +3
==========================================
+ Hits 2453 2635 +182
+ Misses 1278 1118 -160
- Partials 13 14 +1
Continue to review full report at Codecov.
|
Produces failed test: Shrunk 0 time(s) Got error: Error: expect(received).toHaveLength(expected) Expected length: 0 Received length: 1 Received array: [["2020 Schedule 8812 (Form 1040)", [[13, ["topmostSubform[0].Page1[0].f1_12[0]", "2946387.6"]]]]] Stack trace: Error: expect(received).toHaveLength(expected) Expected length: 0 Received length: 1 Received array: [["2020 Schedule 8812 (Form 1040)", [[13, ["topmostSubform[0].Page1[0].f1_12[0]", "2946387.6"]]]]] 87 | await fc.assert( 88 | fc.asyncProperty(arbitraries.information, async (info) => { > 89 | expect(await testEveryField(info, findBadDecimalFormat)).toHaveLength(0) | ^ 90 | }), 91 | { 92 | interruptAfterTimeLimit: 100 * 1000 // 100 seconds at src/tests/pdfFiller/pdfHandler.test.ts:89:66 at AsyncProperty.run (node_modules/fast-check/lib/check/property/AsyncProperty.generic.js:41:28) at asyncRunIt (node_modules/fast-check/lib/check/runner/Runner.js:24:21) at Object.<anonymous> (src/tests/pdfFiller/pdfHandler.test.ts:87:5) Hint: Enable verbose mode in order to have the list of all failing values encountered during the run at asyncThrowIfFailed (node_modules/fast-check/lib/check/runner/utils/RunDetailsFormatter.js:133:11) Fix comment
Either two decimal places or zero Refactor states forms, same numeric implementation
59c124b
to
9e36050
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
What kind of change does this PR introduce? (delete not applicable)
Rounding formatting errors are present in PDF fields with numeric values.
.30000000004
style errors as well as string formatting such as123.6
are also present.This also refactors things somewhat so we can provide a different downloader in testing. This will also be useful in #686 where pdfs are downloaded from ustaxes.org instead of from the testing machine file system.
See 611de2a for output from failing test.