Skip to content

Commit 4a2049e

Browse files
author
Mitchell Henke
authored
Merge pull request #578 from 18F/mitchellhenke/update-qex-validation
Improve q-expand data validation
2 parents 8993199 + 2e142a8 commit 4a2049e

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

config/q-expand.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1179,7 +1179,7 @@ Q1BA,Division 1
11791179
Q1BB,Division 2
11801180
Q1BBA,Branch A
11811181
Q1BBB,Branch B
1182-
Q2,"Deputy Commissioner/Director,"
1182+
Q2,"Deputy Commissioner/Director"
11831183
Q2A,Office of TTS Delivery
11841184
Q2A0A,Technology Operations Division
11851185
Q2AA,Office of Solutions

src/scripts/q-expand.test.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,8 @@ describe("q-expand csv data", () => {
245245
}
246246
});
247247

248-
it("is formatted correctly", async () =>
249-
new Promise((resolve) => {
248+
it("is formatted correctly", async () => {
249+
const invalidCount = await new Promise((resolve) => {
250250
const rows = [];
251251

252252
fs.createReadStream("config/q-expand.csv")
@@ -255,9 +255,15 @@ describe("q-expand csv data", () => {
255255
rows.push(row);
256256
})
257257
.on("end", () => {
258-
const invalid = rows.filter((row) => row.length !== 2);
259-
expect(invalid.length).toBe(0);
260-
resolve();
258+
const invalid = rows.filter(
259+
(row) =>
260+
row.length !== 2 ||
261+
row.filter((column) => column.endsWith(",")).length > 0,
262+
);
263+
resolve(invalid.length);
261264
});
262-
}));
265+
});
266+
267+
expect(invalidCount).toBe(0);
268+
});
263269
});

0 commit comments

Comments
 (0)