Commit 756c8e8
committed
test(compound_v2): cover constructor defaultVtoken fallback chain
compound_v2.ts branches went 45.45% → 69.56%. The CompoundV2Adapter
constructor picks defaultVtoken from contracts via the `??` chain:
vusdt → vusdc → vbnb → comptroller
Previously only the vusdt rung was hit (every fixture set it). This
commit adds 4 tests reaching into the private `defaultVtoken` field
to assert each rung:
- vusdc selected when vusdt absent
- vbnb selected when vusdt + vusdc absent
- comptroller as last-resort defaultVtoken when no v* entries
(deliberate so brand-new Venus forks can stand up the adapter
before fixture data lands; resolveVtoken still fails without a
cache but the constructor must not)
- empty contracts {} → constructor throws
"Missing vToken or comptroller"
Field access is via `(adapter as { defaultVtoken: Address })` rather
than routing through buildSupply, which would otherwise hit
resolveVtoken's RPC fallback and need its own readContract mock for
each test.1 parent d58307f commit 756c8e8
1 file changed
Lines changed: 56 additions & 0 deletions
Lines changed: 56 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
391 | 391 | | |
392 | 392 | | |
393 | 393 | | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
0 commit comments