Skip to content

Commit

Permalink
refactor: remove redundant check
Browse files Browse the repository at this point in the history
  • Loading branch information
patsier-cms committed Jul 25, 2023
1 parent f0e6944 commit 832a85a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 20 deletions.
8 changes: 0 additions & 8 deletions src/csv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -361,14 +361,6 @@ export function validateColumns(columns: string[]): CsvValidationError[] {
export function validateWideColumns(columns: string[]): CsvValidationError[] {
const rowIndex = 2
const errors: CsvValidationError[] = []
const wideColumns = getWideColumns(columns)

// TODO: incorporate order later on?
wideColumns.forEach((column) => {
if (!columns.some((c) => sepColumnsEqual(column, c))) {
errors.push(csvErr(rowIndex, 0, column, `Missing column "${column}"`))
}
})

if (columns[columns.length - 1] !== "additional_generic_notes") {
errors.push(
Expand Down
16 changes: 4 additions & 12 deletions test/csv.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,24 +98,16 @@ test("validateColumns tall", (t) => {
})

test("validateWideColumns", (t) => {
// Currently only checking for the order of additional_generic_notes
t.is(
validateWideColumns([
...BASE_COLUMNS,
...MIN_MAX_COLUMNS,
"standard_charge |Payer | Plan",
"additional_generic_notes",
])[0].message,
`Missing column "standard_charge | Payer | Plan | percent"`
)
t.is(
validateWideColumns([
...BASE_COLUMNS,
...MIN_MAX_COLUMNS,
"standard_charge |Payer | Plan",
"standard_charge | Payer |Plan | pct",
"standard_charge | Payer | Plan",
"additional_generic_notes",
"standard_charge | Payer | Plan | pct",
]).length,
3
1
)
})

Expand Down

0 comments on commit 832a85a

Please sign in to comment.