@@ -30,7 +30,8 @@ contract MockReader {
3030 uint256 subscriptionId ,
3131 bytes32 [] memory priceIds
3232 ) external view returns (PythStructs.Price[] memory ) {
33- return IScheduler (_scheduler).getEmaPriceUnsafe (subscriptionId, priceIds);
33+ return
34+ IScheduler (_scheduler).getEmaPriceUnsafe (subscriptionId, priceIds);
3435 }
3536
3637 function verifyPriceFeeds (
@@ -49,7 +50,8 @@ contract MockReader {
4950 if (
5051 actualPrices[i].price != expectedFeeds[i].price.price ||
5152 actualPrices[i].conf != expectedFeeds[i].price.conf ||
52- actualPrices[i].publishTime != expectedFeeds[i].price.publishTime
53+ actualPrices[i].publishTime !=
54+ expectedFeeds[i].price.publishTime
5355 ) {
5456 return false ;
5557 }
@@ -731,7 +733,7 @@ contract SchedulerTest is Test, SchedulerEvents, PulseTestUtils {
731733 "Price feeds verification failed "
732734 );
733735 }
734-
736+
735737 function testGetEmaPriceUnsafe () public {
736738 // First add a subscription, funds, and update price feeds
737739 uint256 subscriptionId = addTestSubscription ();
@@ -743,15 +745,15 @@ contract SchedulerTest is Test, SchedulerEvents, PulseTestUtils {
743745 PythStructs.PriceFeed[] memory priceFeeds = createMockPriceFeeds (
744746 publishTime
745747 );
746-
748+
747749 // Ensure EMA prices are set in the mock price feeds
748750 for (uint i = 0 ; i < priceFeeds.length ; i++ ) {
749751 priceFeeds[i].emaPrice.price = priceFeeds[i].price.price * 2 ; // Make EMA price different for testing
750752 priceFeeds[i].emaPrice.conf = priceFeeds[i].price.conf;
751753 priceFeeds[i].emaPrice.publishTime = publishTime;
752754 priceFeeds[i].emaPrice.expo = priceFeeds[i].price.expo;
753755 }
754-
756+
755757 mockParsePriceFeedUpdates (pyth, priceFeeds);
756758 bytes [] memory updateData = createMockUpdateData (priceFeeds);
757759
@@ -771,7 +773,7 @@ contract SchedulerTest is Test, SchedulerEvents, PulseTestUtils {
771773 priceIds.length ,
772774 "Should return all EMA prices "
773775 );
774-
776+
775777 // Verify EMA price values
776778 for (uint i = 0 ; i < emaPrices.length ; i++ ) {
777779 assertEq (
@@ -841,11 +843,7 @@ contract SchedulerTest is Test, SchedulerEvents, PulseTestUtils {
841843 3 ,
842844 "Should have 3 active subscription params "
843845 );
844- assertEq (
845- totalCount,
846- 3 ,
847- "Total count should be 3 "
848- );
846+ assertEq (totalCount, 3 , "Total count should be 3 " );
849847
850848 // Verify subscription params
851849 for (uint i = 0 ; i < activeIds.length ; i++ ) {
@@ -866,38 +864,50 @@ contract SchedulerTest is Test, SchedulerEvents, PulseTestUtils {
866864 "Heartbeat seconds mismatch "
867865 );
868866 }
869-
867+
870868 // Test pagination - get only the first subscription
871869 vm.prank (owner);
872870 (
873871 uint256 [] memory firstPageIds ,
874872 SchedulerState.SubscriptionParams[] memory firstPageParams ,
875873 uint256 firstPageTotal
876874 ) = scheduler.getActiveSubscriptions (0 , 1 );
877-
878- assertEq (firstPageIds.length , 1 , "Should have 1 subscription in first page " );
875+
876+ assertEq (
877+ firstPageIds.length ,
878+ 1 ,
879+ "Should have 1 subscription in first page "
880+ );
879881 assertEq (firstPageTotal, 3 , "Total count should still be 3 " );
880-
882+
881883 // Test pagination - get the second page
882884 vm.prank (owner);
883885 (
884886 uint256 [] memory secondPageIds ,
885887 SchedulerState.SubscriptionParams[] memory secondPageParams ,
886888 uint256 secondPageTotal
887889 ) = scheduler.getActiveSubscriptions (1 , 2 );
888-
889- assertEq (secondPageIds.length , 2 , "Should have 2 subscriptions in second page " );
890+
891+ assertEq (
892+ secondPageIds.length ,
893+ 2 ,
894+ "Should have 2 subscriptions in second page "
895+ );
890896 assertEq (secondPageTotal, 3 , "Total count should still be 3 " );
891-
897+
892898 // Test pagination - start index beyond total count
893899 vm.prank (owner);
894900 (
895901 uint256 [] memory emptyPageIds ,
896902 SchedulerState.SubscriptionParams[] memory emptyPageParams ,
897903 uint256 emptyPageTotal
898904 ) = scheduler.getActiveSubscriptions (10 , 10 );
899-
900- assertEq (emptyPageIds.length , 0 , "Should have 0 subscriptions when start index is beyond total " );
905+
906+ assertEq (
907+ emptyPageIds.length ,
908+ 0 ,
909+ "Should have 0 subscriptions when start index is beyond total "
910+ );
901911 assertEq (emptyPageTotal, 3 , "Total count should still be 3 " );
902912 }
903913
0 commit comments