Commit 16dafe9
chore(runway): cherry-pick fix(predict): cp-7.62.0 use bestAsk from live price updates (buy) (#24894)
- fix(predict): cp-7.62.0 use bestAsk from live price updates (buy)
(#24852)
## **Description**
Updates unit tests for `PredictActionButtons` and `PredictGameChart`
components to accommodate the logic change from using `price` to
`bestAsk` for live price updates.
1. **Reason for change**: The components were updated to use `bestAsk`
(the ask price) instead of `price` from live price updates for more
accurate pricing display.
2. **Solution**: Updated test expectations and mock data to reflect the
new `bestAsk` usage.
## **Changelog**
CHANGELOG entry: null
## **Related issues**
https://consensyssoftware.atlassian.net/browse/PRED-491
## **Manual testing steps**
```gherkin
Feature: Unit tests for Predict components
Scenario: Tests pass with bestAsk price logic
Given the test suite is run
When running yarn jest PredictActionButtons.test.tsx PredictGameChart.wrapper.test.tsx
Then all tests pass successfully
```
## **Screenshots/Recordings**
N/A - Test-only changes
### **Before**
N/A
### **After**
N/A
## **Pre-merge author checklist**
- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I've included tests if applicable
- [x] I've documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I've applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
## **Pre-merge reviewer checklist**
- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Adopts `bestAsk` from live price updates for more accurate displayed
buy prices.
>
> - Updates `PredictActionButtons.tsx` to use `yesLivePrice.bestAsk` /
`noLivePrice.bestAsk` when available
> - Updates `PredictGameChart.tsx` live update logic to compute values
from `bestAsk`
> - Adjusts unit tests and mocks to include `bestAsk` fields and new
expected cent values (e.g., 72→73, 80→81, 55→56)
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
c99ff04. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
[52b9241](52b9241)
Co-authored-by: Luis Taniça <matallui@gmail.com>1 parent 6932d5a commit 16dafe9
4 files changed
Lines changed: 78 additions & 24 deletions
File tree
- app/components/UI/Predict/components
- PredictActionButtons
- PredictGameChart
Lines changed: 5 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
361 | 361 | | |
362 | 362 | | |
363 | 363 | | |
364 | | - | |
365 | | - | |
| 364 | + | |
| 365 | + | |
366 | 366 | | |
367 | 367 | | |
368 | 368 | | |
| |||
397 | 397 | | |
398 | 398 | | |
399 | 399 | | |
400 | | - | |
| 400 | + | |
401 | 401 | | |
402 | 402 | | |
403 | 403 | | |
| |||
459 | 459 | | |
460 | 460 | | |
461 | 461 | | |
462 | | - | |
463 | | - | |
| 462 | + | |
| 463 | + | |
464 | 464 | | |
465 | 465 | | |
466 | 466 | | |
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
44 | | - | |
| 43 | + | |
| 44 | + | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
142 | | - | |
| 142 | + | |
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
| |||
Lines changed: 70 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
385 | 385 | | |
386 | 386 | | |
387 | 387 | | |
388 | | - | |
389 | | - | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
390 | 406 | | |
391 | 407 | | |
392 | 408 | | |
| |||
424 | 440 | | |
425 | 441 | | |
426 | 442 | | |
427 | | - | |
428 | 443 | | |
429 | | - | |
430 | | - | |
| 444 | + | |
431 | 445 | | |
432 | 446 | | |
433 | 447 | | |
| |||
469 | 483 | | |
470 | 484 | | |
471 | 485 | | |
472 | | - | |
473 | | - | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
474 | 504 | | |
475 | 505 | | |
476 | 506 | | |
| |||
560 | 590 | | |
561 | 591 | | |
562 | 592 | | |
563 | | - | |
| 593 | + | |
| 594 | + | |
564 | 595 | | |
565 | 596 | | |
566 | 597 | | |
| |||
609 | 640 | | |
610 | 641 | | |
611 | 642 | | |
612 | | - | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
613 | 649 | | |
614 | 650 | | |
615 | 651 | | |
| |||
632 | 668 | | |
633 | 669 | | |
634 | 670 | | |
635 | | - | |
| 671 | + | |
636 | 672 | | |
637 | 673 | | |
638 | 674 | | |
| |||
656 | 692 | | |
657 | 693 | | |
658 | 694 | | |
659 | | - | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
660 | 701 | | |
661 | 702 | | |
662 | 703 | | |
663 | | - | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
664 | 710 | | |
665 | 711 | | |
666 | 712 | | |
| |||
682 | 728 | | |
683 | 729 | | |
684 | 730 | | |
685 | | - | |
| 731 | + | |
686 | 732 | | |
687 | 733 | | |
688 | 734 | | |
| |||
709 | 755 | | |
710 | 756 | | |
711 | 757 | | |
712 | | - | |
713 | | - | |
| 758 | + | |
| 759 | + | |
714 | 760 | | |
715 | 761 | | |
716 | 762 | | |
| |||
894 | 940 | | |
895 | 941 | | |
896 | 942 | | |
897 | | - | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
898 | 952 | | |
899 | 953 | | |
900 | 954 | | |
| |||
0 commit comments