| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 912eb30 commit 2865cbb
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -346,7 +346,7 @@ const callsfunc = tracker.calls(func); | |||
| 346 | 346 | callsfunc(1, 2, 3); | |
| 347 | 347 | ||
| 348 | 348 | assert.deepStrictEqual(tracker.getCalls(callsfunc), | |
| 349 | - [{ thisArg: this, arguments: [1, 2, 3 ] }]); | ||
| 349 | + [{ thisArg: undefined, arguments: [1, 2, 3] }]); | ||
| 350 | 350 | ``` | |
| 351 | 351 | ||
| 352 | 352 | ```cjs | |
@@ -360,7 +360,7 @@ const callsfunc = tracker.calls(func); | |||
| 360 | 360 | callsfunc(1, 2, 3); | |
| 361 | 361 | ||
| 362 | 362 | assert.deepStrictEqual(tracker.getCalls(callsfunc), | |
| 363 | - [{ thisArg: this, arguments: [1, 2, 3 ] }]); | ||
| 363 | + [{ thisArg: undefined, arguments: [1, 2, 3] }]); | ||
| 364 | 364 | ``` | |
| 365 | 365 | ||
| 366 | 366 | ### `tracker.report()` | |
@@ -397,7 +397,7 @@ function func() {} | |||
| 397 | 397 | const callsfunc = tracker.calls(func, 2); | |
| 398 | 398 | ||
| 399 | 399 | // Returns an array containing information on callsfunc() | |
| 400 | - tracker.report(); | ||
| 400 | + console.log(tracker.report()); | ||
| 401 | 401 | // [ | |
| 402 | 402 | // { | |
| 403 | 403 | // message: 'Expected the func function to be executed 2 time(s) but was | |
@@ -423,7 +423,7 @@ function func() {} | |||
| 423 | 423 | const callsfunc = tracker.calls(func, 2); | |
| 424 | 424 | ||
| 425 | 425 | // Returns an array containing information on callsfunc() | |
| 426 | - tracker.report(); | ||
| 426 | + console.log(tracker.report()); | ||
| 427 | 427 | // [ | |
| 428 | 428 | // { | |
| 429 | 429 | // message: 'Expected the func function to be executed 2 time(s) but was | |
@@ -458,24 +458,26 @@ const callsfunc = tracker.calls(func); | |||
| 458 | 458 | ||
| 459 | 459 | callsfunc(); | |
| 460 | 460 | // Tracker was called once | |
| 461 | - tracker.getCalls(callsfunc).length === 1; | ||
| 461 | + assert.strictEqual(tracker.getCalls(callsfunc).length, 1); | ||
| 462 | 462 | ||
| 463 | 463 | tracker.reset(callsfunc); | |
| 464 | - tracker.getCalls(callsfunc).length === 0; | ||
| 464 | + assert.strictEqual(tracker.getCalls(callsfunc).length, 0); | ||
| 465 | 465 | ``` | |
| 466 | 466 | ||
| 467 | 467 | ```cjs | |
| 468 | 468 | const assert = require('node:assert'); | |
| 469 | 469 | ||
| 470 | + const tracker = new assert.CallTracker(); | ||
| 471 | + | ||
| 470 | 472 | function func() {} | |
| 471 | 473 | const callsfunc = tracker.calls(func); | |
| 472 | 474 | ||
| 473 | 475 | callsfunc(); | |
| 474 | 476 | // Tracker was called once | |
| 475 | - tracker.getCalls(callsfunc).length === 1; | ||
| 477 | + assert.strictEqual(tracker.getCalls(callsfunc).length, 1); | ||
| 476 | 478 | ||
| 477 | 479 | tracker.reset(callsfunc); | |
| 478 | - tracker.getCalls(callsfunc).length === 0; | ||
| 480 | + assert.strictEqual(tracker.getCalls(callsfunc).length, 0); | ||
| 479 | 481 | ``` | |
| 480 | 482 | ||
| 481 | 483 | ### `tracker.verify()` | |
| Back | FazBrowse Home | New Git URL |
0 commit comments