Skip to content

Commit 75bcb87

Browse files
replace TASK and SUBTASK in tests with camel case
1 parent 17c0d94 commit 75bcb87

File tree

1 file changed

+37
-37
lines changed
  • v-next/hardhat/test/internal/cli

1 file changed

+37
-37
lines changed

Diff for: v-next/hardhat/test/internal/cli/main.ts

+37-37
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,23 @@ interface TaskRes {
2020
describe("main", function () {
2121
let hre: HardhatRuntimeEnvironment;
2222

23-
// TASKS and SUBTASKS are defined in the "before()" hooks before every "functionality test groups".
24-
let TASK: NewTaskDefinition;
25-
let SUBTASK: NewTaskDefinition;
23+
// newTaskDefinitionS and newSubtaskDefinitionS are defined in the "before()" hooks before every "functionality test groups".
24+
let newTaskDefinition: NewTaskDefinition;
25+
let newSubtaskDefinition: NewTaskDefinition;
2626

2727
describe("parseTaskAndArguments", function () {
2828
describe("only task and subtask", function () {
2929
before(async function () {
30-
TASK = task(["task"])
30+
newTaskDefinition = task(["task"])
3131
.setAction(() => {})
3232
.build();
3333

34-
SUBTASK = task(["task", "subtask"])
34+
newSubtaskDefinition = task(["task", "subtask"])
3535
.setAction(() => {})
3636
.build();
3737

3838
hre = await createHardhatRuntimeEnvironment({
39-
tasks: [TASK, SUBTASK],
39+
tasks: [newTaskDefinition, newSubtaskDefinition],
4040
});
4141
});
4242

@@ -52,15 +52,15 @@ describe("main", function () {
5252
hre,
5353
) as TaskRes;
5454

55-
assert.equal(res.task.id, SUBTASK.id);
55+
assert.equal(res.task.id, newSubtaskDefinition.id);
5656
assert.deepEqual(usedCliArguments, [true, true, true, true]);
5757
assert.deepEqual(res.taskArguments, {});
5858
});
5959
});
6060

6161
describe("task and subtask with named parameters", function () {
6262
before(async function () {
63-
TASK = task(["task"])
63+
newTaskDefinition = task(["task"])
6464
.addNamedParameter({ name: "param" })
6565
.addNamedParameter({
6666
name: "flag",
@@ -72,13 +72,13 @@ describe("main", function () {
7272
.setAction(() => {})
7373
.build();
7474

75-
SUBTASK = task(["task", "subtask"])
75+
newSubtaskDefinition = task(["task", "subtask"])
7676
.addNamedParameter({ name: "param" })
7777
.setAction(() => {})
7878
.build();
7979

8080
hre = await createHardhatRuntimeEnvironment({
81-
tasks: [TASK, SUBTASK],
81+
tasks: [newTaskDefinition, newSubtaskDefinition],
8282
});
8383
});
8484

@@ -94,7 +94,7 @@ describe("main", function () {
9494
hre,
9595
) as TaskRes;
9696

97-
assert.equal(res.task.id, TASK.id);
97+
assert.equal(res.task.id, newTaskDefinition.id);
9898
assert.deepEqual(usedCliArguments, [true, true, true]);
9999
assert.deepEqual(res.taskArguments, {
100100
param: "<paramValue>",
@@ -113,7 +113,7 @@ describe("main", function () {
113113
hre,
114114
) as TaskRes;
115115

116-
assert.equal(res.task.id, SUBTASK.id);
116+
assert.equal(res.task.id, newSubtaskDefinition.id);
117117
assert.deepEqual(usedCliArguments, [true, true, true, true]);
118118
assert.deepEqual(res.taskArguments, {
119119
param: "<paramValue>",
@@ -132,7 +132,7 @@ describe("main", function () {
132132
hre,
133133
) as TaskRes;
134134

135-
assert.equal(res.task.id, TASK.id);
135+
assert.equal(res.task.id, newTaskDefinition.id);
136136
assert.deepEqual(usedCliArguments, [true, true]);
137137
assert.deepEqual(res.taskArguments, { flag: true });
138138
});
@@ -149,7 +149,7 @@ describe("main", function () {
149149
hre,
150150
) as TaskRes;
151151

152-
assert.equal(res.task.id, TASK.id);
152+
assert.equal(res.task.id, newTaskDefinition.id);
153153
assert.deepEqual(usedCliArguments, [true, true, true]);
154154
assert.deepEqual(res.taskArguments, { flag: false });
155155
});
@@ -167,7 +167,7 @@ describe("main", function () {
167167
hre,
168168
) as TaskRes;
169169

170-
assert.equal(res.task.id, TASK.id);
170+
assert.equal(res.task.id, newTaskDefinition.id);
171171
assert.deepEqual(usedCliArguments, [true, true, true]);
172172
assert.deepEqual(res.taskArguments, { optionFlag: "<value>" });
173173
});
@@ -226,7 +226,7 @@ describe("main", function () {
226226

227227
describe("task and subtask with positional parameters", function () {
228228
before(async function () {
229-
TASK = task(["task"])
229+
newTaskDefinition = task(["task"])
230230
.addPositionalParameter({ name: "param" })
231231
.addPositionalParameter({
232232
name: "param2",
@@ -235,7 +235,7 @@ describe("main", function () {
235235
.setAction(() => {})
236236
.build();
237237

238-
SUBTASK = task(["task", "subtask"])
238+
newSubtaskDefinition = task(["task", "subtask"])
239239
.addPositionalParameter({ name: "param" })
240240
.addPositionalParameter({
241241
name: "param2",
@@ -245,7 +245,7 @@ describe("main", function () {
245245
.build();
246246

247247
hre = await createHardhatRuntimeEnvironment({
248-
tasks: [TASK, SUBTASK],
248+
tasks: [newTaskDefinition, newSubtaskDefinition],
249249
});
250250
});
251251

@@ -261,7 +261,7 @@ describe("main", function () {
261261
hre,
262262
) as TaskRes;
263263

264-
assert.equal(res.task.id, TASK.id);
264+
assert.equal(res.task.id, newTaskDefinition.id);
265265
assert.deepEqual(usedCliArguments, [true, true]);
266266
assert.deepEqual(res.taskArguments, {
267267
param: "<paramValue>",
@@ -281,7 +281,7 @@ describe("main", function () {
281281
hre,
282282
) as TaskRes;
283283

284-
assert.equal(res.task.id, TASK.id);
284+
assert.equal(res.task.id, newTaskDefinition.id);
285285
assert.deepEqual(usedCliArguments, [true, true, true]);
286286
assert.deepEqual(res.taskArguments, {
287287
param: "subtask",
@@ -301,7 +301,7 @@ describe("main", function () {
301301
hre,
302302
) as TaskRes;
303303

304-
assert.equal(res.task.id, TASK.id);
304+
assert.equal(res.task.id, newTaskDefinition.id);
305305
assert.deepEqual(usedCliArguments, [true, true, true]);
306306
assert.deepEqual(res.taskArguments, {
307307
param: "foo",
@@ -321,7 +321,7 @@ describe("main", function () {
321321
hre,
322322
) as TaskRes;
323323

324-
assert.equal(res.task.id, SUBTASK.id);
324+
assert.equal(res.task.id, newSubtaskDefinition.id);
325325
assert.deepEqual(usedCliArguments, [true, true, true]);
326326
assert.deepEqual(res.taskArguments, {
327327
param: "<paramValue>",
@@ -340,7 +340,7 @@ describe("main", function () {
340340
hre,
341341
) as TaskRes;
342342

343-
assert.equal(res.task.id, SUBTASK.id);
343+
assert.equal(res.task.id, newSubtaskDefinition.id);
344344
assert.deepEqual(usedCliArguments, [true, true, true, true]);
345345
assert.deepEqual(res.taskArguments, {
346346
param: "<paramValue>",
@@ -351,13 +351,13 @@ describe("main", function () {
351351

352352
describe("task and subtask with variadic parameters", function () {
353353
before(async function () {
354-
TASK = task(["task"])
354+
newTaskDefinition = task(["task"])
355355
.addVariadicParameter({ name: "param" })
356356
.setAction(() => {})
357357
.build();
358358

359359
hre = await createHardhatRuntimeEnvironment({
360-
tasks: [TASK, SUBTASK],
360+
tasks: [newTaskDefinition, newSubtaskDefinition],
361361
});
362362
});
363363

@@ -373,7 +373,7 @@ describe("main", function () {
373373
hre,
374374
) as TaskRes;
375375

376-
assert.equal(res.task.id, TASK.id);
376+
assert.equal(res.task.id, newTaskDefinition.id);
377377
assert.deepEqual(usedCliArguments, [true, true, true, true]);
378378
assert.deepEqual(res.taskArguments, {
379379
param: ["<val1>", "<val2>", "<val3>"],
@@ -392,7 +392,7 @@ describe("main", function () {
392392
hre,
393393
) as TaskRes;
394394

395-
assert.equal(res.task.id, TASK.id);
395+
assert.equal(res.task.id, newTaskDefinition.id);
396396
assert.deepEqual(usedCliArguments, [true]);
397397
assert.deepEqual(res.taskArguments, {});
398398
});
@@ -401,7 +401,7 @@ describe("main", function () {
401401
describe("formatting of parameters types", function () {
402402
describe("named parameters", function () {
403403
before(async function () {
404-
TASK = task(["task"])
404+
newTaskDefinition = task(["task"])
405405
.addNamedParameter({ name: "param", type: ParameterType.BIGINT })
406406
.addNamedParameter({ name: "param2", type: ParameterType.BOOLEAN })
407407
.addNamedParameter({ name: "param3", type: ParameterType.FILE })
@@ -412,7 +412,7 @@ describe("main", function () {
412412
.build();
413413

414414
hre = await createHardhatRuntimeEnvironment({
415-
tasks: [TASK],
415+
tasks: [newTaskDefinition],
416416
});
417417
});
418418

@@ -452,7 +452,7 @@ describe("main", function () {
452452

453453
describe("positional parameters", function () {
454454
before(async function () {
455-
TASK = task(["task"])
455+
newTaskDefinition = task(["task"])
456456
.addPositionalParameter({
457457
name: "param",
458458
type: ParameterType.BIGINT,
@@ -478,7 +478,7 @@ describe("main", function () {
478478
.build();
479479

480480
hre = await createHardhatRuntimeEnvironment({
481-
tasks: [TASK],
481+
tasks: [newTaskDefinition],
482482
});
483483
});
484484

@@ -533,7 +533,7 @@ describe("main", function () {
533533
it("should correctly format the parameters accordingly to their types", async function () {
534534
// Variadic parameters can only be of a single type at a time, so loop through all the types
535535
for (let i = 0; i < paramTypes.length; i++) {
536-
TASK = task(["task"])
536+
newTaskDefinition = task(["task"])
537537
.addVariadicParameter({
538538
name: "param",
539539
type: paramTypes[i],
@@ -542,7 +542,7 @@ describe("main", function () {
542542
.build();
543543

544544
hre = await createHardhatRuntimeEnvironment({
545-
tasks: [TASK],
545+
tasks: [newTaskDefinition],
546546
});
547547

548548
const command = `npx hardhat task ${paramValues[i]}`;
@@ -563,7 +563,7 @@ describe("main", function () {
563563

564564
describe("combine all the parameters' types", function () {
565565
before(async function () {
566-
TASK = task(["task"])
566+
newTaskDefinition = task(["task"])
567567
.addNamedParameter({ name: "param" })
568568
.addPositionalParameter({ name: "posParam" })
569569
.addPositionalParameter({
@@ -574,12 +574,12 @@ describe("main", function () {
574574
.setAction(() => {})
575575
.build();
576576

577-
SUBTASK = task(["task", "subtask"])
577+
newSubtaskDefinition = task(["task", "subtask"])
578578
.setAction(() => {})
579579
.build();
580580

581581
hre = await createHardhatRuntimeEnvironment({
582-
tasks: [TASK, SUBTASK],
582+
tasks: [newTaskDefinition, newSubtaskDefinition],
583583
});
584584
});
585585

@@ -607,7 +607,7 @@ describe("main", function () {
607607
hre,
608608
) as TaskRes;
609609

610-
assert.equal(res.task.id, TASK.id);
610+
assert.equal(res.task.id, newTaskDefinition.id);
611611
assert.deepEqual(usedCliArguments, [
612612
true,
613613
true,

0 commit comments

Comments
 (0)