@@ -40,38 +40,38 @@ class EpochStatisticsControllerTest < ActionDispatch::IntegrationTest
4040 end
4141
4242 test "should return difficulty, uncle_rate and epoch number" do
43- ( 1 ..15 ) . each { |number | create ( :epoch_statistic , epoch_number : number ) }
43+ ( 1 ..15 ) . each { |number | create ( :epoch_statistic , epoch_number : number ) }
4444 block_statistic_data = EpochStatistic . order ( epoch_number : :desc ) . reverse
4545 valid_get api_v1_epoch_statistic_url ( "difficulty-uncle_rate" )
4646
47- assert_equal [ %w( difficulty uncle_rate epoch_number largest_block largest_tx last_updated_timestamp ) . sort ] , json . dig ( "data" ) . map { |item | item . dig ( "attributes" ) . keys . sort } . uniq
47+ assert_equal [ %w( difficulty uncle_rate epoch_number largest_block largest_tx created_at_unixtimestamp ) . sort ] , json . dig ( "data" ) . map { |item | item . dig ( "attributes" ) . keys . sort } . uniq
4848 assert_equal EpochStatisticSerializer . new ( block_statistic_data , { params : { indicator : "difficulty-uncle_rate" } } ) . serialized_json , response . body
4949 end
5050
5151 test "should return difficulty, hash_rate and epoch number" do
52- ( 1 ..15 ) . each { |number | create ( :epoch_statistic , epoch_number : number ) }
52+ ( 1 ..15 ) . each { |number | create ( :epoch_statistic , epoch_number : number ) }
5353 block_statistic_data = EpochStatistic . order ( epoch_number : :desc ) . reverse
5454 valid_get api_v1_epoch_statistic_url ( "difficulty-hash_rate" )
5555
56- assert_equal [ %w( difficulty hash_rate epoch_number largest_block largest_tx last_updated_timestamp ) . sort ] , json . dig ( "data" ) . map { |item | item . dig ( "attributes" ) . keys . sort } . uniq
56+ assert_equal [ %w( difficulty hash_rate epoch_number largest_block largest_tx created_at_unixtimestamp ) . sort ] , json . dig ( "data" ) . map { |item | item . dig ( "attributes" ) . keys . sort } . uniq
5757 assert_equal EpochStatisticSerializer . new ( block_statistic_data , { params : { indicator : "difficulty-hash_rate" } } ) . serialized_json , response . body
5858 end
5959
6060 test "should return epoch_time and epoch_length" do
61- ( 1 ..15 ) . each { |number | create ( :epoch_statistic , epoch_number : number ) }
61+ ( 1 ..15 ) . each { |number | create ( :epoch_statistic , epoch_number : number ) }
6262 block_statistic_data = EpochStatistic . order ( epoch_number : :desc ) . reverse
6363 valid_get api_v1_epoch_statistic_url ( "epoch_time-epoch_length" )
6464
65- assert_equal [ %w( epoch_length epoch_time epoch_number largest_block largest_tx last_updated_timestamp ) . sort ] , json . dig ( "data" ) . map { |item | item . dig ( "attributes" ) . keys . sort } . uniq
65+ assert_equal [ %w( epoch_length epoch_time epoch_number largest_block largest_tx created_at_unixtimestamp ) . sort ] , json . dig ( "data" ) . map { |item | item . dig ( "attributes" ) . keys . sort } . uniq
6666 assert_equal EpochStatisticSerializer . new ( block_statistic_data , { params : { indicator : "epoch_time-epoch_length" } } ) . serialized_json , response . body
6767 end
6868
6969 test "should return latest 10 epoch statistics when limit is not present" do
70- ( 1 ..15 ) . each { |number | create ( :epoch_statistic , epoch_number : number ) }
70+ ( 1 ..15 ) . each { |number | create ( :epoch_statistic , epoch_number : number ) }
7171 block_statistic_data = EpochStatistic . order ( epoch_number : :desc ) . limit ( 10 ) . reverse
7272 valid_get api_v1_epoch_statistic_url ( "difficulty-uncle_rate" , limit : 10 )
7373
74- assert_equal [ %w( difficulty uncle_rate epoch_number largest_block largest_tx last_updated_timestamp ) . sort ] , json . dig ( "data" ) . map { |item | item . dig ( "attributes" ) . keys . sort } . uniq
74+ assert_equal [ %w( difficulty uncle_rate epoch_number largest_block largest_tx created_at_unixtimestamp ) . sort ] , json . dig ( "data" ) . map { |item | item . dig ( "attributes" ) . keys . sort } . uniq
7575 assert_equal EpochStatisticSerializer . new ( block_statistic_data , { params : { indicator : "difficulty-uncle_rate" } } ) . serialized_json , response . body
7676 end
7777
0 commit comments