Update tests

pull/1030/head
jimmay5469 6 years ago
parent 0a80f12985
commit a55c602836
  1. 367
      apps/block_scout_web/assets/__tests__/pages/address.js
  2. 5
      apps/block_scout_web/assets/js/pages/address.js
  3. 1
      apps/block_scout_web/lib/block_scout_web/channels/address_channel.ex
  4. 5
      apps/block_scout_web/lib/block_scout_web/controllers/address_transaction_controller.ex
  5. 2
      apps/block_scout_web/lib/block_scout_web/templates/internal_transaction/_tile.html.eex
  6. 38
      apps/block_scout_web/test/block_scout_web/controllers/address_transaction_controller_test.exs

@ -1,300 +1,327 @@
import { reducer, initialState } from '../../js/pages/address' import { reducer, initialState } from '../../js/pages/address'
describe('PAGE_LOAD', () => { describe('RECEIVED_NEW_BLOCK', () => {
test('page 1 without filter', () => { test('with new block', () => {
const state = initialState const state = Object.assign({}, initialState, {
const action = { validationCount: 30,
type: 'PAGE_LOAD', validatedBlocks: [{ blockNumber: 1, blockHtml: 'test 1' }]
addressHash: '1234',
beyondPageOne: false,
pendingTransactionHashes: ['1']
}
const output = reducer(state, action)
expect(output.addressHash).toBe('1234')
expect(output.beyondPageOne).toBe(false)
expect(output.filter).toBe(undefined)
expect(output.pendingTransactionHashes).toEqual(['1'])
}) })
test('page 2 without filter', () => {
const state = initialState
const action = { const action = {
type: 'PAGE_LOAD', type: 'RECEIVED_NEW_BLOCK',
addressHash: '1234', msg: { blockNumber: 2, blockHtml: 'test 2' }
beyondPageOne: true,
pendingTransactionHashes: ['1']
} }
const output = reducer(state, action) const output = reducer(state, action)
expect(output.addressHash).toBe('1234') expect(output.validationCount).toEqual(31)
expect(output.beyondPageOne).toBe(true) expect(output.validatedBlocks).toEqual([
expect(output.filter).toBe(undefined) { blockNumber: 2, blockHtml: 'test 2' },
expect(output.pendingTransactionHashes).toEqual(['1']) { blockNumber: 1, blockHtml: 'test 1' }
])
})
test('when channel has been disconnected', () => {
const state = Object.assign({}, initialState, {
channelDisconnected: true,
validationCount: 30,
validatedBlocks: [{ blockNumber: 1, blockHtml: 'test 1' }]
}) })
test('page 1 with "to" filter', () => {
const state = initialState
const action = { const action = {
type: 'PAGE_LOAD', type: 'RECEIVED_NEW_BLOCK',
addressHash: '1234', msg: { blockNumber: 2, blockHtml: 'test 2' }
beyondPageOne: false,
filter: 'to'
} }
const output = reducer(state, action) const output = reducer(state, action)
expect(output.addressHash).toBe('1234') expect(output.validationCount).toEqual(30)
expect(output.beyondPageOne).toBe(false) expect(output.validatedBlocks).toEqual([
expect(output.filter).toBe('to') { blockNumber: 1, blockHtml: 'test 1' }
])
}) })
test('page 2 with "to" filter', () => { test('beyond page one', () => {
const state = initialState const state = Object.assign({}, initialState, {
const action = {
type: 'PAGE_LOAD',
addressHash: '1234',
beyondPageOne: true, beyondPageOne: true,
filter: 'to' validationCount: 30,
validatedBlocks: [{ blockNumber: 1, blockHtml: 'test 1' }]
})
const action = {
type: 'RECEIVED_NEW_BLOCK',
msg: { blockNumber: 2, blockHtml: 'test 2' }
} }
const output = reducer(state, action) const output = reducer(state, action)
expect(output.addressHash).toBe('1234') expect(output.validationCount).toEqual(31)
expect(output.beyondPageOne).toBe(true) expect(output.validatedBlocks).toEqual([
expect(output.filter).toBe('to') { blockNumber: 1, blockHtml: 'test 1' }
])
}) })
}) })
test('CHANNEL_DISCONNECTED', () => { describe('RECEIVED_NEW_INTERNAL_TRANSACTION_BATCH', () => {
const state = initialState test('with new internal transaction', () => {
const state = Object.assign({}, initialState, {
internalTransactions: [{ internalTransactionHtml: 'test 1' }]
})
const action = { const action = {
type: 'CHANNEL_DISCONNECTED' type: 'RECEIVED_NEW_INTERNAL_TRANSACTION_BATCH',
msgs: [{ internalTransactionHtml: 'test 2' }]
} }
const output = reducer(state, action) const output = reducer(state, action)
expect(output.channelDisconnected).toBe(true) expect(output.internalTransactions).toEqual([
{ internalTransactionHtml: 'test 2' },
{ internalTransactionHtml: 'test 1' }
])
})
test('with batch of new internal transactions', () => {
const state = Object.assign({}, initialState, {
internalTransactions: [{ internalTransactionHtml: 'test 1' }]
}) })
test('RECEIVED_UPDATED_BALANCE', () => {
const state = initialState
const action = { const action = {
type: 'RECEIVED_UPDATED_BALANCE', type: 'RECEIVED_NEW_INTERNAL_TRANSACTION_BATCH',
msg: { msgs: [
balance: 'hello world' { internalTransactionHtml: 'test 2' },
} { internalTransactionHtml: 'test 3' },
{ internalTransactionHtml: 'test 4' },
{ internalTransactionHtml: 'test 5' },
{ internalTransactionHtml: 'test 6' },
{ internalTransactionHtml: 'test 7' },
{ internalTransactionHtml: 'test 8' },
{ internalTransactionHtml: 'test 9' },
{ internalTransactionHtml: 'test 10' },
{ internalTransactionHtml: 'test 11' },
{ internalTransactionHtml: 'test 12' },
{ internalTransactionHtml: 'test 13' }
]
} }
const output = reducer(state, action) const output = reducer(state, action)
expect(output.balance).toBe('hello world') expect(output.internalTransactions).toEqual([
{ internalTransactionHtml: 'test 1' }
])
expect(output.internalTransactionsBatch).toEqual([
{ internalTransactionHtml: 'test 13' },
{ internalTransactionHtml: 'test 12' },
{ internalTransactionHtml: 'test 11' },
{ internalTransactionHtml: 'test 10' },
{ internalTransactionHtml: 'test 9' },
{ internalTransactionHtml: 'test 8' },
{ internalTransactionHtml: 'test 7' },
{ internalTransactionHtml: 'test 6' },
{ internalTransactionHtml: 'test 5' },
{ internalTransactionHtml: 'test 4' },
{ internalTransactionHtml: 'test 3' },
{ internalTransactionHtml: 'test 2' },
])
})
test('after batch of new internal transactions', () => {
const state = Object.assign({}, initialState, {
internalTransactionsBatch: [{ internalTransactionHtml: 'test 1' }]
}) })
describe('RECEIVED_NEW_PENDING_TRANSACTION', () => {
test('single transaction', () => {
const state = initialState
const action = { const action = {
type: 'RECEIVED_NEW_PENDING_TRANSACTION', type: 'RECEIVED_NEW_INTERNAL_TRANSACTION_BATCH',
msg: { msgs: [
transactionHash: '0x00', { internalTransactionHtml: 'test 2' }
transactionHtml: 'test' ]
}
} }
const output = reducer(state, action) const output = reducer(state, action)
expect(output.newPendingTransactions).toEqual(['test']) expect(output.internalTransactionsBatch).toEqual([
expect(output.transactionCount).toEqual(null) { internalTransactionHtml: 'test 2' },
{ internalTransactionHtml: 'test 1' }
])
}) })
test('single transaction after single transaction', () => { test('when channel has been disconnected', () => {
const state = Object.assign({}, initialState, { const state = Object.assign({}, initialState, {
newPendingTransactions: ['test 1'] channelDisconnected: true,
internalTransactions: [{ internalTransactionHtml: 'test 1' }]
}) })
const action = { const action = {
type: 'RECEIVED_NEW_PENDING_TRANSACTION', type: 'RECEIVED_NEW_INTERNAL_TRANSACTION_BATCH',
msg: { msgs: [{ internalTransactionHtml: 'test 2' }]
transactionHash: '0x02',
transactionHtml: 'test 2'
}
} }
const output = reducer(state, action) const output = reducer(state, action)
expect(output.newPendingTransactions).toEqual(['test 1', 'test 2']) expect(output.internalTransactions).toEqual([
expect(output.pendingTransactionHashes.length).toEqual(1) { internalTransactionHtml: 'test 1' }
])
}) })
test('after disconnection', () => { test('beyond page one', () => {
const state = Object.assign({}, initialState, { const state = Object.assign({}, initialState, {
channelDisconnected: true beyondPageOne: true,
internalTransactions: [{ internalTransactionHtml: 'test 1' }]
}) })
const action = { const action = {
type: 'RECEIVED_NEW_PENDING_TRANSACTION', type: 'RECEIVED_NEW_INTERNAL_TRANSACTION_BATCH',
msg: { msgs: [{ internalTransactionHtml: 'test 2' }]
transactionHash: '0x00',
transactionHtml: 'test'
}
} }
const output = reducer(state, action) const output = reducer(state, action)
expect(output.newPendingTransactions).toEqual([]) expect(output.internalTransactions).toEqual([
expect(output.pendingTransactionHashes).toEqual([]) { internalTransactionHtml: 'test 1' }
])
}) })
test('on page 2', () => { test('with filtered out internal transaction', () => {
const state = Object.assign({}, initialState, { const state = Object.assign({}, initialState, {
beyondPageOne: true filter: 'to'
}) })
const action = { const action = {
type: 'RECEIVED_NEW_PENDING_TRANSACTION', type: 'RECEIVED_NEW_INTERNAL_TRANSACTION_BATCH',
msg: { msgs: [{ internalTransactionHtml: 'test 2' }]
transactionHash: '0x00',
transactionHtml: 'test'
}
} }
const output = reducer(state, action) const output = reducer(state, action)
expect(output.newPendingTransactions).toEqual([]) expect(output.internalTransactions).toEqual([])
expect(output.pendingTransactionHashes).toEqual([])
}) })
}) })
describe('RECEIVED_NEW_TRANSACTION', () => { describe('RECEIVED_NEW_PENDING_TRANSACTION', () => {
test('single transaction', () => { test('with new pending transaction', () => {
const state = Object.assign({}, initialState, { const state = Object.assign({}, initialState, {
addressHash: '0x111' pendingTransactions: [{ transactionHash: 1, transactionHtml: 'test 1' }]
}) })
const action = { const action = {
type: 'RECEIVED_NEW_TRANSACTION', type: 'RECEIVED_NEW_PENDING_TRANSACTION',
msg: { msg: { transactionHash: 2, transactionHtml: 'test 2' }
transactionHtml: 'test'
}
} }
const output = reducer(state, action) const output = reducer(state, action)
expect(output.newTransactions).toEqual([{ transactionHtml: 'test' }]) expect(output.pendingTransactions).toEqual([
expect(output.transactionCount).toEqual(null) { transactionHash: 2, transactionHtml: 'test 2' },
{ transactionHash: 1, transactionHtml: 'test 1' }
])
}) })
test('single transaction after single transaction', () => { test('when channel has been disconnected', () => {
const state = Object.assign({}, initialState, { const state = Object.assign({}, initialState, {
newTransactions: [{ transactionHtml: 'test 1' }] channelDisconnected: true,
pendingTransactions: [{ transactionHash: 1, transactionHtml: 'test 1' }]
}) })
const action = { const action = {
type: 'RECEIVED_NEW_TRANSACTION', type: 'RECEIVED_NEW_PENDING_TRANSACTION',
msg: { msg: { transactionHash: 2, transactionHtml: 'test 2' }
transactionHtml: 'test 2'
}
} }
const output = reducer(state, action) const output = reducer(state, action)
expect(output.newTransactions).toEqual([ expect(output.pendingTransactions).toEqual([
{ transactionHtml: 'test 1' }, { transactionHash: 1, transactionHtml: 'test 1' }
{ transactionHtml: 'test 2' }
]) ])
}) })
test('after disconnection', () => { test('beyond page one', () => {
const state = Object.assign({}, initialState, { const state = Object.assign({}, initialState, {
channelDisconnected: true beyondPageOne: true,
pendingTransactions: [{ transactionHash: 1, transactionHtml: 'test 1' }]
}) })
const action = { const action = {
type: 'RECEIVED_NEW_TRANSACTION', type: 'RECEIVED_NEW_PENDING_TRANSACTION',
msg: { msg: { transactionHash: 2, transactionHtml: 'test 2' }
transactionHtml: 'test'
}
} }
const output = reducer(state, action) const output = reducer(state, action)
expect(output.newTransactions).toEqual([]) expect(output.pendingTransactions).toEqual([
{ transactionHash: 1, transactionHtml: 'test 1' }
])
}) })
test('on page 2', () => { test('with filtered out pending transaction', () => {
const state = Object.assign({}, initialState, { const state = Object.assign({}, initialState, {
beyondPageOne: true, filter: 'to'
transactionCount: 1,
addressHash: '0x111'
}) })
const action = { const action = {
type: 'RECEIVED_NEW_TRANSACTION', type: 'RECEIVED_NEW_PENDING_TRANSACTION',
msg: { msg: { transactionHash: 2, transactionHtml: 'test 2' }
transactionHtml: 'test'
}
} }
const output = reducer(state, action) const output = reducer(state, action)
expect(output.newTransactions).toEqual([]) expect(output.pendingTransactions).toEqual([])
expect(output.transactionCount).toEqual(1)
}) })
test('transaction from current address with "from" filter', () => { })
describe('RECEIVED_NEW_TRANSACTION', () => {
test('with new transaction', () => {
const state = Object.assign({}, initialState, { const state = Object.assign({}, initialState, {
addressHash: '1234', pendingTransactions: [{ transactionHash: 2, transactionHtml: 'test' }],
filter: 'from' transactions: [{ transactionHash: 1, transactionHtml: 'test 1' }]
}) })
const action = { const action = {
type: 'RECEIVED_NEW_TRANSACTION', type: 'RECEIVED_NEW_TRANSACTION',
msg: { msg: { transactionHash: 2, transactionHtml: 'test 2' }
fromAddressHash: '1234',
transactionHtml: 'test'
}
} }
const output = reducer(state, action) const output = reducer(state, action)
expect(output.newTransactions).toEqual([ expect(output.pendingTransactions).toEqual([
{ fromAddressHash: '1234', transactionHtml: 'test' } { transactionHash: 2, transactionHtml: 'test 2', validated: true }
])
expect(output.transactions).toEqual([
{ transactionHash: 2, transactionHtml: 'test 2' },
{ transactionHash: 1, transactionHtml: 'test 1' }
]) ])
}) })
test('transaction from current address with "to" filter', () => { test('when channel has been disconnected', () => {
const state = Object.assign({}, initialState, { const state = Object.assign({}, initialState, {
addressHash: '1234', channelDisconnected: true,
filter: 'to' pendingTransactions: [{ transactionHash: 2, transactionHtml: 'test' }],
transactions: [{ transactionHash: 1, transactionHtml: 'test 1' }]
}) })
const action = { const action = {
type: 'RECEIVED_NEW_TRANSACTION', type: 'RECEIVED_NEW_TRANSACTION',
msg: { msg: { transactionHash: 2, transactionHtml: 'test 2' }
fromAddressHash: '1234',
transactionHtml: 'test'
}
} }
const output = reducer(state, action) const output = reducer(state, action)
expect(output.newTransactions).toEqual([]) expect(output.pendingTransactions).toEqual([
{ transactionHash: 2, transactionHtml: 'test' }
])
expect(output.transactions).toEqual([
{ transactionHash: 1, transactionHtml: 'test 1' }
])
}) })
test('transaction to current address with "to" filter', () => { test('beyond page one', () => {
const state = Object.assign({}, initialState, { const state = Object.assign({}, initialState, {
addressHash: '1234', beyondPageOne: true,
filter: 'to' transactions: [{ transactionHash: 1, transactionHtml: 'test 1' }]
}) })
const action = { const action = {
type: 'RECEIVED_NEW_TRANSACTION', type: 'RECEIVED_NEW_TRANSACTION',
msg: { msg: { transactionHash: 2, transactionHtml: 'test 2' }
toAddressHash: '1234',
transactionHtml: 'test'
}
} }
const output = reducer(state, action) const output = reducer(state, action)
expect(output.newTransactions).toEqual([ expect(output.pendingTransactions).toEqual([])
{ toAddressHash: '1234', transactionHtml: 'test' } expect(output.transactions).toEqual([
{ transactionHash: 1, transactionHtml: 'test 1' }
]) ])
}) })
test('transaction to current address with "from" filter', () => { test('with filtered out transaction', () => {
const state = Object.assign({}, initialState, { const state = Object.assign({}, initialState, {
addressHash: '1234', filter: 'to'
filter: 'from'
}) })
const action = { const action = {
type: 'RECEIVED_NEW_TRANSACTION', type: 'RECEIVED_NEW_TRANSACTION',
msg: { msg: { transactionHash: 2, transactionHtml: 'test 2' }
toAddressHash: '1234',
transactionHtml: 'test'
}
} }
const output = reducer(state, action) const output = reducer(state, action)
expect(output.newTransactions).toEqual([]) expect(output.transactions).toEqual([])
})
})
describe('RECEIVED_NEXT_TRANSACTIONS_PAGE', () => {
test('with new transaction page', () => {
const state = Object.assign({}, initialState, {
loadingNextPage: true,
nextPage: '1',
transactions: [{ transactionHash: 1, transactionHtml: 'test 1' }]
}) })
test('single transaction collated from pending', () => {
const state = initialState
const action = { const action = {
type: 'RECEIVED_NEW_TRANSACTION', type: 'RECEIVED_NEXT_TRANSACTIONS_PAGE',
msg: { msg: {
transactionHash: '0x00', nextPage: '2',
transactionHtml: 'test' transactions: [{ transactionHash: 2, transactionHtml: 'test 2' }]
} }
} }
const output = reducer(state, action) const output = reducer(state, action)
expect(output.newTransactions).toEqual([ expect(output.loadingNextPage).toEqual(false)
{ transactionHash: '0x00', transactionHtml: 'test' } expect(output.nextPage).toEqual('2')
expect(output.transactions).toEqual([
{ transactionHash: 1, transactionHtml: 'test 1' },
{ transactionHash: 2, transactionHtml: 'test 2' }
]) ])
expect(output.transactionCount).toEqual(null)
}) })
}) })

@ -103,8 +103,6 @@ export function reducer (state = initialState, action) {
}) })
} }
case 'REMOVE_PENDING_TRANSACTION': { case 'REMOVE_PENDING_TRANSACTION': {
if (state.channelDisconnected) return state
return Object.assign({}, state, { return Object.assign({}, state, {
pendingTransactions: state.pendingTransactions.filter((transaction) => action.msg.transactionHash !== transaction.transactionHash) pendingTransactions: state.pendingTransactions.filter((transaction) => action.msg.transactionHash !== transaction.transactionHash)
}) })
@ -247,7 +245,6 @@ const elements = {
load ($el) { load ($el) {
return { return {
internalTransactions: $el.children().map((index, el) => ({ internalTransactions: $el.children().map((index, el) => ({
internalTransactionId: el.dataset.internalTransactionId,
internalTransactionHtml: el.outerHTML internalTransactionHtml: el.outerHTML
})).toArray() })).toArray()
} }
@ -256,7 +253,7 @@ const elements = {
if (oldState.internalTransactions === state.internalTransactions) return if (oldState.internalTransactions === state.internalTransactions) return
const container = $el[0] const container = $el[0]
const newElements = _.map(state.internalTransactions, ({ internalTransactionHtml }) => $(internalTransactionHtml)[0]) const newElements = _.map(state.internalTransactions, ({ internalTransactionHtml }) => $(internalTransactionHtml)[0])
listMorph(container, newElements, { key: 'dataset.internalTransactionId' }) listMorph(container, newElements, { key: 'dataset.key' })
} }
}, },
'[data-selector="channel-batching-count"]': { '[data-selector="channel-batching-count"]': {

@ -55,7 +55,6 @@ defmodule BlockScoutWeb.AddressChannel do
push(socket, "internal_transaction", %{ push(socket, "internal_transaction", %{
to_address_hash: to_string(internal_transaction.to_address_hash), to_address_hash: to_string(internal_transaction.to_address_hash),
from_address_hash: to_string(internal_transaction.from_address_hash), from_address_hash: to_string(internal_transaction.from_address_hash),
internal_transaction_id: to_string(internal_transaction.id),
internal_transaction_html: rendered_internal_transaction internal_transaction_html: rendered_internal_transaction
}) })

@ -8,10 +8,10 @@ defmodule BlockScoutWeb.AddressTransactionController do
import BlockScoutWeb.AddressController, only: [transaction_count: 1, validation_count: 1] import BlockScoutWeb.AddressController, only: [transaction_count: 1, validation_count: 1]
import BlockScoutWeb.Chain, only: [current_filter: 1, paging_options: 1, next_page_params: 3, split_list_by_page: 1] import BlockScoutWeb.Chain, only: [current_filter: 1, paging_options: 1, next_page_params: 3, split_list_by_page: 1]
alias BlockScoutWeb.TransactionView
alias Explorer.{Chain, Market} alias Explorer.{Chain, Market}
alias Explorer.ExchangeRates.Token
alias Explorer.Chain.Hash alias Explorer.Chain.Hash
alias BlockScoutWeb.{InternalTransactionView, AddressView, TransactionView} alias Explorer.ExchangeRates.Token
alias Phoenix.View alias Phoenix.View
def index(conn, %{"address_id" => address_hash_string, "type" => "JSON"} = params) do def index(conn, %{"address_id" => address_hash_string, "type" => "JSON"} = params) do
@ -87,6 +87,7 @@ defmodule BlockScoutWeb.AddressTransactionController do
:token_transfers => :optional :token_transfers => :optional
} }
] ]
|> Keyword.merge(paging_options(%{}))
|> Keyword.merge(current_filter(params)) |> Keyword.merge(current_filter(params))
full_options = put_in(pending_options, [:necessity_by_association, :block], :required) full_options = put_in(pending_options, [:necessity_by_association, :block], :required)

@ -1,4 +1,4 @@
<div class="tile tile-type-internal-transaction fade-in" data-test="internal_transaction" data-internal-transaction-transaction-hash="<%= @internal_transaction.transaction_hash %>" data-internal-transaction-index="<%= @internal_transaction.index %>"> <div class="tile tile-type-internal-transaction fade-in" data-test="internal_transaction" data-key="<%= @internal_transaction.transaction_hash %>_<%= @internal_transaction.index %>" data-internal-transaction-transaction-hash="<%= @internal_transaction.transaction_hash %>" data-internal-transaction-index="<%= @internal_transaction.index %>">
<div class="row"> <div class="row">
<div class="col-md-2 d-flex flex-row flex-md-column align-items-left justify-content-start justify-content-lg-center mb-1 mb-md-0 pl-md-4"> <div class="col-md-2 d-flex flex-row flex-md-column align-items-left justify-content-start justify-content-lg-center mb-1 mb-md-0 pl-md-4">
<%= gettext("Internal Transaction") %> <%= gettext("Internal Transaction") %>

@ -76,7 +76,7 @@ defmodule BlockScoutWeb.AddressTransactionControllerTest do
50 50
|> insert_list(:transaction, from_address: address) |> insert_list(:transaction, from_address: address)
|> with_block() |> with_block()
|> Enum.map(& &1.hash) |> Enum.map(&to_string(&1.hash))
%Transaction{block_number: block_number, index: index} = %Transaction{block_number: block_number, index: index} =
:transaction :transaction
@ -85,47 +85,21 @@ defmodule BlockScoutWeb.AddressTransactionControllerTest do
conn = conn =
get(conn, address_transaction_path(BlockScoutWeb.Endpoint, :index, address.hash), %{ get(conn, address_transaction_path(BlockScoutWeb.Endpoint, :index, address.hash), %{
"type" => "JSON",
"block_number" => Integer.to_string(block_number), "block_number" => Integer.to_string(block_number),
"index" => Integer.to_string(index) "index" => Integer.to_string(index)
}) })
{:ok, %{"transactions" => transactions}} = conn.resp_body |> Poison.decode()
actual_hashes = actual_hashes =
conn.assigns.transactions transactions
|> Enum.map(& &1.hash) |> Enum.map(& &1["transaction_hash"])
|> Enum.reverse() |> Enum.reverse()
assert second_page_hashes == actual_hashes assert second_page_hashes == actual_hashes
end end
test "does not return pending transactions if beyond page one", %{conn: conn} do
address = insert(:address)
50
|> insert_list(:transaction, from_address: address)
|> with_block()
|> Enum.map(& &1.hash)
%Transaction{block_number: block_number, index: index} =
:transaction
|> insert(from_address: address)
|> with_block()
pending = insert(:transaction, from_address: address, to_address: address)
conn =
get(conn, address_transaction_path(BlockScoutWeb.Endpoint, :index, address.hash), %{
"block_number" => Integer.to_string(block_number),
"index" => Integer.to_string(index)
})
actual_pending_hashes =
conn.assigns.pending_transactions
|> Enum.map(& &1.hash)
|> Enum.reverse()
refute Enum.member?(actual_pending_hashes, pending.hash)
end
test "next_page_params exist if not on last page", %{conn: conn} do test "next_page_params exist if not on last page", %{conn: conn} do
address = insert(:address) address = insert(:address)
block = %Block{number: number} = insert(:block) block = %Block{number: number} = insert(:block)

Loading…
Cancel
Save