Skip to content

Commit a09adab

Browse files
committed
removed try/catch and fallback to default sample data
1 parent 75bd5e6 commit a09adab

File tree

1 file changed

+16
-25
lines changed

1 file changed

+16
-25
lines changed

typescript/tests/concept/parameterized-examples.test.ts

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -168,31 +168,22 @@ describe("Parameterize from File", () => {
168168
expectedUpper: string;
169169
expectedLen: number;
170170
}> {
171-
try {
172-
const csvPath = join(__dirname, "test-data.csv");
173-
const content = readFileSync(csvPath, "utf-8");
174-
const lines = content.trim().split("\n");
175-
lines.shift(); // Skip header
176-
177-
return lines.map((line) => {
178-
const [input, expectedUpper, expectedLen] = line.split(",");
179-
if (!input || !expectedUpper || !expectedLen) {
180-
throw new Error(`Invalid CSV line: ${line}`);
181-
}
182-
return {
183-
input,
184-
expectedUpper,
185-
expectedLen: Number.parseInt(expectedLen, 10),
186-
};
187-
});
188-
} catch {
189-
// Return sample data if file doesn't exist
190-
return [
191-
{ input: "test", expectedUpper: "TEST", expectedLen: 4 },
192-
{ input: "hello", expectedUpper: "HELLO", expectedLen: 5 },
193-
{ input: "world", expectedUpper: "WORLD", expectedLen: 5 },
194-
];
195-
}
171+
const csvPath = join(__dirname, "test-data.csv");
172+
const content = readFileSync(csvPath, "utf-8");
173+
const lines = content.trim().split("\n");
174+
lines.shift(); // Skip header
175+
176+
return lines.map((line) => {
177+
const [input, expectedUpper, expectedLen] = line.split(",");
178+
if (!input || !expectedUpper || !expectedLen) {
179+
throw new Error(`Invalid CSV line: ${line}`);
180+
}
181+
return {
182+
input,
183+
expectedUpper,
184+
expectedLen: Number.parseInt(expectedLen, 10),
185+
};
186+
});
196187
}
197188

198189
const csvData = loadCsvData();

0 commit comments

Comments
 (0)