Skip to content

Commit 128d53c

Browse files
gameromannfriedly
andauthored
Apply suggestions from code review
Co-authored-by: Nathan Friedly <nathan@nfriedly.com>
1 parent f11f3c1 commit 128d53c

2 files changed

Lines changed: 12 additions & 44 deletions

File tree

test/command_injection.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ describe("command injection", () => {
5757

5858
for (const [index, testCase] of testCases.entries()) {
5959
test(
60-
`should NOT execute commands from the list of sources: ${index + 1}`,
60+
`should NOT execute commands from the list of sources: ${JSON.stringify(testCase)}`,
6161
{ skip: !hasNativeZip },
6262
async () => {
6363
try {

test/old.test.js

Lines changed: 11 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,8 @@ describe("bestzip", function () {
3939
});
4040

4141
afterEach(async function () {
42-
try {
43-
await fs.rm(extractFolderPath, { recursive: true, force: true });
44-
} catch {
45-
// ignore
46-
}
47-
try {
48-
await fs.rm(destinationFilePath, { force: true });
49-
} catch {
50-
// ignore
51-
}
42+
await fs.rm(extractFolderPath, { recursive: true, force: true });
43+
await fs.rm(destinationFilePath, { force: true });
5244
});
5345

5446
it("should create archive", async function () {
@@ -85,19 +77,11 @@ describe("bestzip", function () {
8577
validArchiveExtractedFile1Path;
8678

8779
afterEach(async function () {
88-
try {
89-
await fs.rm(validArchiveExtractFolder, {
90-
recursive: true,
91-
force: true,
92-
});
93-
} catch {
94-
// ignore
95-
}
96-
try {
97-
await fs.rm(validArchiveFilePath, { force: true });
98-
} catch {
99-
// ignore
100-
}
80+
await fs.rm(validArchiveExtractFolder, {
81+
recursive: true,
82+
force: true,
83+
});
84+
await fs.rm(validArchiveFilePath, { force: true });
10185
});
10286

10387
it("should contain valid data after unarchive", async function () {
@@ -150,16 +134,8 @@ describe("bestzip", function () {
150134
});
151135

152136
afterEach(async function () {
153-
try {
154-
await fs.rm(extractFolderPath, { recursive: true, force: true });
155-
} catch {
156-
// ignore
157-
}
158-
try {
159-
await fs.rm(destinationFilePath, { force: true });
160-
} catch {
161-
// ignore
162-
}
137+
await fs.rm(extractFolderPath, { recursive: true, force: true });
138+
await fs.rm(destinationFilePath, { force: true });
163139
});
164140

165141
it("should create archive", async function () {
@@ -217,19 +193,11 @@ describe("bestzip", function () {
217193
});
218194

219195
afterEach(async function () {
220-
try {
221-
await fs.rm(validArchiveExtractFolder, {
196+
await fs.rm(validArchiveExtractFolder, {
222197
recursive: true,
223198
force: true,
224199
});
225-
} catch {
226-
// ignore
227-
}
228-
try {
229-
await fs.rm(validArchiveFilePath, { force: true });
230-
} catch {
231-
// ignore
232-
}
200+
await fs.rm(validArchiveFilePath, { force: true });
233201
});
234202

235203
it("should contain valid data after unarchive", async function () {

0 commit comments

Comments
 (0)