Skip to content

Commit

Permalink
Fix January 2025 enforcement tests
Browse files Browse the repository at this point in the history
Fix out-of-date error messages in January 2025 requirements tests.
Fix check for "warning" attribute in January 2025 requirements tests.
  • Loading branch information
mint-thompson committed Jan 14, 2025
1 parent a9d2493 commit 28b75fc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
3 changes: 2 additions & 1 deletion test/2.0/csv.e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ test("validate columns with date-dependent enforcement", async (t) => {
},
{
path: "A1",
message: "Errors were seen in headers so rows were not evaluated",
message:
"Errors were found in the headers or values in rows 1 through 3, so the remaining rows were not evaluated.",
},
])
} else {
Expand Down
8 changes: 4 additions & 4 deletions test/2.0/csv.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -361,15 +361,15 @@ test("validateRow tall", (t) => {
emptyDrugUnitResult[0].message,
'A value is required for "drug_unit_of_measurement" when "drug_type_of_measurement" is present. You must encode the missing information.'
)
t.assert(emptyDrugUnitResult[0].warning === !enforce2025)
t.assert(emptyDrugUnitResult[0].warning === (enforce2025 ? undefined : true))
const wrongDrugUnitRow = { ...basicRow, drug_unit_of_measurement: "-4" }
const wrongDrugUnitResult = validateRow(wrongDrugUnitRow, 10, columns, false)
t.is(wrongDrugUnitResult.length, 1)
t.is(
wrongDrugUnitResult[0].message,
'"drug_unit_of_measurement" value "-4" is not a positive number. You must encode a positive, non-zero, numeric value.'
)
t.assert(wrongDrugUnitResult[0].warning === !enforce2025)
t.assert(wrongDrugUnitResult[0].warning === (enforce2025 ? undefined : true))
// drug_type_of_measurement must be one of DRUG_UNITS if present
const emptyDrugTypeRow = { ...basicRow, drug_type_of_measurement: "" }
const emptyDrugTypeResult = validateRow(emptyDrugTypeRow, 12, columns, false)
Expand All @@ -378,15 +378,15 @@ test("validateRow tall", (t) => {
emptyDrugTypeResult[0].message,
'A value is required for "drug_type_of_measurement" when "drug_unit_of_measurement" is present. You must encode the missing information.'
)
t.assert(emptyDrugTypeResult[0].warning === !enforce2025)
t.assert(emptyDrugTypeResult[0].warning === (enforce2025 ? undefined : true))
const wrongDrugTypeRow = { ...basicRow, drug_type_of_measurement: "KG" }
const wrongDrugTypeResult = validateRow(wrongDrugTypeRow, 12, columns, false)
t.is(wrongDrugTypeResult.length, 1)
t.is(
wrongDrugTypeResult[0].message,
'"drug_type_of_measurement" value "KG" is not one of the allowed valid values. You must encode one of these valid values: GR, ME, ML, UN, F2, EA, GM'
)
t.assert(wrongDrugTypeResult[0].warning === !enforce2025)
t.assert(wrongDrugTypeResult[0].warning === (enforce2025 ? undefined : true))
// standard_charge | gross must be positive number if present
const emptyGrossRow = { ...basicRow, "standard_charge | gross": "" }
const emptyGrossResult = validateRow(emptyGrossRow, 13, columns, false)
Expand Down
14 changes: 7 additions & 7 deletions test/2.0/json.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,13 @@ test("validateJson estimated amount conditional", async (t) => {
path: "/standard_charge_information/0/standard_charges/0/payers_information/3",
field: "3",
message: "must have required property 'estimated_amount'",
warning: enforce2025 ? undefined : true,
...(enforce2025 ? {} : { warning: true }),
},
{
path: "/standard_charge_information/0/standard_charges/0/payers_information/3",
field: "3",
message: 'must match "then" schema',
warning: enforce2025 ? undefined : true,
...(enforce2025 ? {} : { warning: true }),
},
])
})
Expand All @@ -242,13 +242,13 @@ test("validateJson NDC drug information conditional", async (t) => {
path: "/standard_charge_information/0",
field: "",
message: "must have required property 'drug_information'",
warning: enforce2025 ? undefined : true,
...(enforce2025 ? {} : { warning: true }),
},
{
path: "/standard_charge_information/0",
field: "",
message: 'must match "then" schema',
warning: enforce2025 ? undefined : true,
...(enforce2025 ? {} : { warning: true }),
},
])
})
Expand All @@ -266,19 +266,19 @@ test("validateJson 2025 properties", async (t) => {
path: "/standard_charge_information/0/drug_information",
field: "drug_information",
message: "must have required property 'type'",
warning: enforce2025 ? undefined : true,
...(enforce2025 ? {} : { warning: true }),
},
{
path: "/standard_charge_information/1/standard_charges/0/payers_information/1/estimated_amount",
field: "estimated_amount",
message: "must be number",
warning: enforce2025 ? undefined : true,
...(enforce2025 ? {} : { warning: true }),
},
{
path: "/modifier_information/0",
field: "0",
message: "must have required property 'modifier_payer_information'",
warning: enforce2025 ? undefined : true,
...(enforce2025 ? {} : { warning: true }),
},
])
})
Expand Down

0 comments on commit 28b75fc

Please sign in to comment.