Skip to content

Commit c08e03b

Browse files
committed
chore: do not pass nullable nor any objects to assert.ok function
1 parent b99029d commit c08e03b

File tree

3 files changed

+24
-24
lines changed

3 files changed

+24
-24
lines changed

v-next/core/src/internal/user-interruptions.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ async function defaultRequestSecretInput(
121121
}
122122

123123
assertHardhatInvariant(
124-
rlAsAny.output,
124+
rlAsAny.output !== undefined,
125125
"Espected readline output to be defined",
126126
);
127127

v-next/core/test/internal/tasks/task-manager.ts

+14-14
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ describe("TaskManagerImplementation", () => {
165165
assert.equal(task1.pluginId, "plugin1");
166166
assert.equal(task1.description, "description2");
167167
// Original args should have not been removed
168-
assert.ok(task1.options.get("arg1"), "Should have arg1");
169-
assert.ok(task1.options.get("flag1"), "Should have flag1");
168+
assert.notEqual(task1.options.get("arg1"), undefined, "Should have arg1");
169+
assert.notEqual(task1.options.get("flag1"), undefined, "Should have flag1");
170170
assert.ok(
171171
task1.positionalArguments.some((p) => p.name === "posArg1"),
172172
"Should have posArg1",
@@ -176,8 +176,8 @@ describe("TaskManagerImplementation", () => {
176176
"Should have varArg1",
177177
);
178178
// New args should be added by the overrides
179-
assert.ok(task1.options.get("arg2"), "Should have arg2");
180-
assert.ok(task1.options.get("flag2"), "Should have flag2");
179+
assert.notEqual(task1.options.get("arg2"), undefined, "Should have arg2");
180+
assert.notEqual(task1.options.get("flag2"), undefined, "Should have flag2");
181181
// Should have 2 actions
182182
assert.equal(task1.actions.length, 2);
183183
assert.equal(task1.actions[0].pluginId, "plugin1");
@@ -220,8 +220,8 @@ describe("TaskManagerImplementation", () => {
220220
assert.equal(task1.pluginId, "plugin1");
221221
assert.equal(task1.description, "description2");
222222
// Original args should have not been removed
223-
assert.ok(task1.options.get("arg1"), "Should have arg1");
224-
assert.ok(task1.options.get("flag1"), "Should have flag1");
223+
assert.notEqual(task1.options.get("arg1"), undefined, "Should have arg1");
224+
assert.notEqual(task1.options.get("flag1"), undefined, "Should have flag1");
225225
assert.ok(
226226
task1.positionalArguments.some((p) => p.name === "posArg1"),
227227
"Should have posArg1",
@@ -231,8 +231,8 @@ describe("TaskManagerImplementation", () => {
231231
"Should have varArg1",
232232
);
233233
// New args should be added by the overrides
234-
assert.ok(task1.options.get("arg2"), "Should have arg2");
235-
assert.ok(task1.options.get("flag2"), "Should have flag2");
234+
assert.notEqual(task1.options.get("arg2"), undefined, "Should have arg2");
235+
assert.notEqual(task1.options.get("flag2"), undefined, "Should have flag2");
236236
// Should have 2 actions
237237
assert.equal(task1.actions.length, 2);
238238
assert.equal(task1.actions[0].pluginId, "plugin1");
@@ -282,8 +282,8 @@ describe("TaskManagerImplementation", () => {
282282
assert.equal(task1.pluginId, "plugin1");
283283
assert.equal(task1.description, "description3");
284284
// Original args should have not been removed
285-
assert.ok(task1.options.get("arg1"), "Should have arg1");
286-
assert.ok(task1.options.get("flag1"), "Should have flag1");
285+
assert.notEqual(task1.options.get("arg1"), undefined, "Should have arg1");
286+
assert.notEqual(task1.options.get("flag1"), undefined, "Should have flag1");
287287
assert.ok(
288288
task1.positionalArguments.some((p) => p.name === "posArg1"),
289289
"Should have posArg1",
@@ -293,10 +293,10 @@ describe("TaskManagerImplementation", () => {
293293
"Should have varArg1",
294294
);
295295
// New args should be added by the overrides
296-
assert.ok(task1.options.get("arg2"), "Should have arg2");
297-
assert.ok(task1.options.get("flag2"), "Should have flag2");
298-
assert.ok(task1.options.get("arg3"), "Should have arg3");
299-
assert.ok(task1.options.get("flag3"), "Should have flag3");
296+
assert.notEqual(task1.options.get("arg2"), undefined, "Should have arg2");
297+
assert.notEqual(task1.options.get("flag2"), undefined, "Should have flag2");
298+
assert.notEqual(task1.options.get("arg3"), undefined, "Should have arg3");
299+
assert.notEqual(task1.options.get("flag3"), undefined, "Should have flag3");
300300
// Should have 3 actions
301301
assert.equal(task1.actions.length, 3);
302302
assert.equal(task1.actions[0].pluginId, "plugin1");

v-next/hardhat-utils/test/request.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ describe("Requests util", () => {
262262
mockPool.intercept(baseInterceptorOptions).reply(200, {});
263263
const response = await getRequest(url, undefined, mockPool);
264264

265-
assert.ok(response, "Should return a response");
265+
assert.notEqual(response, undefined, "Should return a response");
266266
assert.equal(response.statusCode, 200);
267267
await response.body.json();
268268
});
@@ -277,7 +277,7 @@ describe("Requests util", () => {
277277
.reply(200, {});
278278
const response = await getRequest(url, { queryParams }, mockPool);
279279

280-
assert.ok(response, "Should return a response");
280+
assert.notEqual(response, undefined, "Should return a response");
281281
assert.equal(response.statusCode, 200);
282282
await response.body.json();
283283
});
@@ -294,7 +294,7 @@ describe("Requests util", () => {
294294
.reply(200, {});
295295
const response = await getRequest(url, { extraHeaders }, mockPool);
296296

297-
assert.ok(response, "Should return a response");
297+
assert.notEqual(response, undefined, "Should return a response");
298298
assert.equal(response.statusCode, 200);
299299
await response.body.json();
300300
});
@@ -347,7 +347,7 @@ describe("Requests util", () => {
347347
mockPool.intercept(baseInterceptorOptions).reply(200, {});
348348
const response = await postJsonRequest(url, body, undefined, mockPool);
349349

350-
assert.ok(response, "Should return a response");
350+
assert.notEqual(response, undefined, "Should return a response");
351351
assert.equal(response.statusCode, 200);
352352
await response.body.json();
353353
});
@@ -369,7 +369,7 @@ describe("Requests util", () => {
369369
mockPool,
370370
);
371371

372-
assert.ok(response, "Should return a response");
372+
assert.notEqual(response, undefined, "Should return a response");
373373
assert.equal(response.statusCode, 200);
374374
await response.body.json();
375375
});
@@ -391,7 +391,7 @@ describe("Requests util", () => {
391391
mockPool,
392392
);
393393

394-
assert.ok(response, "Should return a response");
394+
assert.notEqual(response, undefined, "Should return a response");
395395
assert.equal(response.statusCode, 200);
396396
await response.body.json();
397397
});
@@ -445,7 +445,7 @@ describe("Requests util", () => {
445445
mockPool.intercept(baseInterceptorOptions).reply(200, {});
446446
const response = await postFormRequest(url, body, undefined, mockPool);
447447

448-
assert.ok(response, "Should return a response");
448+
assert.notEqual(response, undefined, "Should return a response");
449449
assert.equal(response.statusCode, 200);
450450
await response.body.json();
451451
});
@@ -467,7 +467,7 @@ describe("Requests util", () => {
467467
mockPool,
468468
);
469469

470-
assert.ok(response, "Should return a response");
470+
assert.notEqual(response, undefined, "Should return a response");
471471
assert.equal(response.statusCode, 200);
472472
await response.body.json();
473473
});
@@ -489,7 +489,7 @@ describe("Requests util", () => {
489489
mockPool,
490490
);
491491

492-
assert.ok(response, "Should return a response");
492+
assert.notEqual(response, undefined, "Should return a response");
493493
assert.equal(response.statusCode, 200);
494494
await response.body.json();
495495
});

0 commit comments

Comments
 (0)