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