Skip to content

Commit 4aa4c7d

Browse files
committed
jest: Use default parameters in test helper
1 parent cb3bce8 commit 4aa4c7d

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

tests/helpers.js

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,8 @@ class FuzzTestBuilder {
245245
* @param {boolean} logTestOutput - whether to print the output of the fuzz test to the console.
246246
* True if parameter is undefined.
247247
*/
248-
logTestOutput(logTestOutput) {
249-
this._logTestOutput = logTestOutput === undefined ? true : logTestOutput;
248+
logTestOutput(logTestOutput = true) {
249+
this._logTestOutput = logTestOutput;
250250
return this;
251251
}
252252

@@ -270,18 +270,17 @@ class FuzzTestBuilder {
270270
/**
271271
* @param {boolean} verbose - set verbose/debug output in fuzz test.
272272
*/
273-
verbose(verbose) {
274-
this._verbose = verbose === undefined ? true : verbose;
273+
verbose(verbose = true) {
274+
this._verbose = verbose;
275275
return this;
276276
}
277277

278278
/**
279279
* @param {boolean} listFuzzTestNames - whether to list all fuzz test names on the console.
280280
* True if parameter is undefined.
281281
*/
282-
listFuzzTestNames(listFuzzTestNames) {
283-
this._listFuzzTestNames =
284-
listFuzzTestNames === undefined ? true : listFuzzTestNames;
282+
listFuzzTestNames(listFuzzTestNames = true) {
283+
this._listFuzzTestNames = listFuzzTestNames;
285284
if (this._listFuzzTestNames) {
286285
this.jestTestName("__NOT_AN_ACTUAL_TESTNAME__");
287286
}
@@ -425,8 +424,8 @@ class FuzzTestBuilder {
425424
return this;
426425
}
427426

428-
coverage(coverage) {
429-
this._coverage = coverage === undefined ? true : coverage;
427+
coverage(coverage = true) {
428+
this._coverage = coverage;
430429
return this;
431430
}
432431

@@ -435,8 +434,8 @@ class FuzzTestBuilder {
435434
return this;
436435
}
437436

438-
asJson(asJson) {
439-
this._asJson = asJson === undefined ? true : asJson;
437+
asJson(asJson = true) {
438+
this._asJson = asJson;
440439
return this;
441440
}
442441

0 commit comments

Comments
 (0)