Skip to content

Commit bf30e57

Browse files
committed
remove unused use case
1 parent 5febdee commit bf30e57

File tree

2 files changed

+25
-81
lines changed

2 files changed

+25
-81
lines changed

test/convert.test.js

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -16,60 +16,20 @@ beforeAll(() => {
1616
});
1717

1818
test("Must be able to convert 100K rows to Excel", async () => {
19-
// const fnNoThrow = async () => {
20-
// return await convertCsvToExcel("./test/100k.csv", "./test/result-100.xlsx");
21-
// };
22-
2319
const res = await convertCsvToExcel(
2420
"./test/100k.csv",
2521
"./test/result-100.xlsx"
2622
);
2723

28-
// expect(fnNoThrow).not.toThrow();
2924
expect(res).toEqual(true);
3025
});
3126

3227
test("Must be able to convert 300K rows to Excel", async () => {
33-
// const fnNoThrow = async () => {
34-
// return await convertCsvToExcel(
35-
// "./test/300k.csv",
36-
// "./test/result-300k.xlsx"
37-
// );
38-
// };
39-
4028
const res = await convertCsvToExcel(
4129
"./test/300k.csv",
4230
"./test/result-300k.xlsx"
4331
);
4432

45-
// expect(fnNoThrow).not.toThrow();
4633
expect(res).toEqual(true);
4734
});
4835

49-
test("Must be able to convert 500K rows to Excel", async () => {
50-
// const fnNoThrow = async () => {
51-
// return await convertCsvToExcel(
52-
// "./test/500k.csv",
53-
// "./test/result-500k.xlsx"
54-
// );
55-
// };
56-
57-
const res = await convertCsvToExcel(
58-
"./test/500k.csv",
59-
"./test/result-500k.xlsx"
60-
);
61-
62-
// expect(fnNoThrow).not.toThrow();
63-
expect(res).toEqual(true);
64-
});
65-
66-
// test("Must be able to convert 1M rows to Excel", async () => {
67-
// // const fnNoThrow = async () => {
68-
// // return await convertCsvToExcel("./test/1m.csv", "./test/result-1m.xlsx");
69-
// // };
70-
71-
// const res = await convertCsvToExcel("./test/1m.csv", "./test/result-1m.xlsx");
72-
73-
// // expect(fnNoThrow).not.toThrow();
74-
// expect(res).toEqual(true);
75-
// });

test/lib.test.js

Lines changed: 25 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const fs = require('fs');
22
const { CsvFileWriter, Converter } = require("../dist");
33

4-
jest.setTimeout(240000);
4+
jest.setTimeout(60000);
55

66
beforeEach(() => {
77
try {
@@ -19,60 +19,44 @@ test("Library is able to create csv", async () => {
1919
"Gender",
2020
]);
2121

22-
// const rows = [
23-
// [1, "John", "Male"],
24-
// [2, "Doe", "Male"],
25-
// ];
22+
const rows = [
23+
[1, "John", "Male"],
24+
[2, "Doe", "Male"],
25+
];
2626

27-
// for (const row of rows) {
28-
// await writer.write(row);
29-
// }
30-
31-
for (let row = 1; row <= 470_000; row++) {
32-
const csvRow = [];
33-
for (let col = 1; col <= 200; col++) {
34-
csvRow.push(`col no ${col}`);
35-
}
36-
await writer.write(csvRow);
27+
for (const row of rows) {
28+
await writer.write(row);
3729
}
3830

3931
await writer.close();
4032

41-
42-
43-
// const content = fs.readFileSync('./test/source-lib.csv', 'utf8');
33+
const content = fs.readFileSync('./test/source-lib.csv', 'utf8');
4434

45-
// expect(content).toEqual(`No,Name,Gender
46-
// 1,John,Male
47-
// 2,Doe,Male
48-
// `)
35+
expect(content).toEqual(`No,Name,Gender
36+
1,John,Male
37+
2,Doe,Male
38+
`)
4939
});
5040

5141
test("Library is able to create and convert xlsx", async () => {
52-
// const writer = new CsvFileWriter("./test/source-lib.csv", [
53-
// "No",
54-
// "Name",
55-
// "Gender",
56-
// ]);
57-
58-
// const rows = [
59-
// [1, "John", "Male"],
60-
// [2, "Doe", "Male"],
61-
// ];
42+
const writer = new CsvFileWriter("./test/source-lib.csv", [
43+
"No",
44+
"Name",
45+
"Gender",
46+
]);
6247

63-
// for (const row of rows) {
64-
// await writer.write(row);
65-
// }
48+
const rows = [
49+
[1, "John", "Male"],
50+
[2, "Doe", "Male"],
51+
];
6652

67-
// await writer.close();
53+
for (const row of rows) {
54+
await writer.write(row);
55+
}
6856

69-
const s = setTimeout(() => {
70-
console.log('event loop running...')
71-
}, 30000)
57+
await writer.close();
7258

7359
const res = await Converter.toXLSX("./test/source-lib.csv", "./test/result-lib.xlsx");
7460

75-
clearTimeout(s);
76-
7761
expect(res).toEqual(true);
7862
});

0 commit comments

Comments
 (0)