-
Notifications
You must be signed in to change notification settings - Fork 343
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
989cb68
commit 67aaa35
Showing
4 changed files
with
60 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"app-avatax": patch | ||
--- | ||
|
||
Added test for suspicious line+tax calculation checker and additional debugging logs |
35 changes: 35 additions & 0 deletions
35
apps/avatax/src/modules/avatax/calculate-taxes/avatax-calculate-taxes-adapter.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { describe, expect, it } from "vitest"; | ||
|
||
import { suspiciousLineCalculationCheck } from "@/modules/avatax/calculate-taxes/avatax-calculate-taxes-adapter"; | ||
|
||
describe("suspiciousLineCalculationCheck", () => { | ||
it("Returns false if line is zero", () => { | ||
expect( | ||
suspiciousLineCalculationCheck({ | ||
total_gross_amount: 0, | ||
total_net_amount: 0, | ||
tax_rate: 0.2, // If its zero-line, it doesn matter | ||
}), | ||
).toBe(false); | ||
}); | ||
|
||
it("Returns true if net & gross is the same, but rate is not: 1.00 + 1.00 + rate 0.08", () => { | ||
expect( | ||
suspiciousLineCalculationCheck({ | ||
total_gross_amount: 1, | ||
total_net_amount: 1, | ||
tax_rate: 0.08, // If its zero-line, it doesn matter | ||
}), | ||
).toBe(true); | ||
}); | ||
|
||
it("Returns true for small numbers: 0.06 + 0.06 + rate 0.07", () => { | ||
expect( | ||
suspiciousLineCalculationCheck({ | ||
total_gross_amount: 0.06, | ||
total_net_amount: 0.06, | ||
tax_rate: 0.07, // If its zero-line, it doesn matter | ||
}), | ||
).toBe(true); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters