|
|
@ -86,4 +86,123 @@ defmodule BlockScoutWeb.LayoutViewTest do |
|
|
|
~s(<a href="https://github.com/poanetwork/blockscout/releases/tag/v1.3.4-beta" class="footer-link" target="_blank">1.3.4</a>)} |
|
|
|
~s(<a href="https://github.com/poanetwork/blockscout/releases/tag/v1.3.4-beta" class="footer-link" target="_blank">1.3.4</a>)} |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@supported_chains_pattern ~s([ { "title": "RSK Mainnet", "url": "https://blockscout.com/rsk/mainnet", "other?": true }, { "title": "POA Sokol", "url": "https://blockscout.com/poa/sokol", "test_net?": true }, { "title": "POA Core", "url": "https://blockscout.com/poa/core" }, { "title": "LUKSO L14 testnet", "url": "https://blockscout.com/lukso/l14", "test_net?": true, "hide_in_dropdown?": true } ]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
describe "other_networks/0" do |
|
|
|
|
|
|
|
test "get networks list based on env variables" do |
|
|
|
|
|
|
|
Application.put_env(:block_scout_web, :other_networks, @supported_chains_pattern) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assert LayoutView.other_networks() == [ |
|
|
|
|
|
|
|
%{ |
|
|
|
|
|
|
|
title: "POA Core", |
|
|
|
|
|
|
|
url: "https://blockscout.com/poa/core" |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
%{ |
|
|
|
|
|
|
|
title: "RSK Mainnet", |
|
|
|
|
|
|
|
url: "https://blockscout.com/rsk/mainnet", |
|
|
|
|
|
|
|
other?: true |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
%{ |
|
|
|
|
|
|
|
title: "POA Sokol", |
|
|
|
|
|
|
|
url: "https://blockscout.com/poa/sokol", |
|
|
|
|
|
|
|
test_net?: true |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
%{ |
|
|
|
|
|
|
|
title: "LUKSO L14 testnet", |
|
|
|
|
|
|
|
url: "https://blockscout.com/lukso/l14", |
|
|
|
|
|
|
|
test_net?: true, |
|
|
|
|
|
|
|
hide_in_dropdown?: true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
describe "main_nets/1" do |
|
|
|
|
|
|
|
test "get all main networks list based on env variables" do |
|
|
|
|
|
|
|
Application.put_env(:block_scout_web, :other_networks, @supported_chains_pattern) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assert LayoutView.main_nets(LayoutView.other_networks()) == [ |
|
|
|
|
|
|
|
%{ |
|
|
|
|
|
|
|
title: "POA Core", |
|
|
|
|
|
|
|
url: "https://blockscout.com/poa/core" |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
%{ |
|
|
|
|
|
|
|
title: "RSK Mainnet", |
|
|
|
|
|
|
|
url: "https://blockscout.com/rsk/mainnet", |
|
|
|
|
|
|
|
other?: true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
describe "test_nets/1" do |
|
|
|
|
|
|
|
test "get all networks list based on env variables" do |
|
|
|
|
|
|
|
Application.put_env(:block_scout_web, :other_networks, @supported_chains_pattern) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assert LayoutView.test_nets(LayoutView.other_networks()) == [ |
|
|
|
|
|
|
|
%{ |
|
|
|
|
|
|
|
title: "POA Sokol", |
|
|
|
|
|
|
|
url: "https://blockscout.com/poa/sokol", |
|
|
|
|
|
|
|
test_net?: true |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
%{ |
|
|
|
|
|
|
|
title: "LUKSO L14 testnet", |
|
|
|
|
|
|
|
url: "https://blockscout.com/lukso/l14", |
|
|
|
|
|
|
|
test_net?: true, |
|
|
|
|
|
|
|
hide_in_dropdown?: true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
describe "dropdown_nets/0" do |
|
|
|
|
|
|
|
test "get all dropdown networks list based on env variables" do |
|
|
|
|
|
|
|
Application.put_env(:block_scout_web, :other_networks, @supported_chains_pattern) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assert LayoutView.dropdown_nets() == [ |
|
|
|
|
|
|
|
%{ |
|
|
|
|
|
|
|
title: "POA Core", |
|
|
|
|
|
|
|
url: "https://blockscout.com/poa/core" |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
%{ |
|
|
|
|
|
|
|
title: "RSK Mainnet", |
|
|
|
|
|
|
|
url: "https://blockscout.com/rsk/mainnet", |
|
|
|
|
|
|
|
other?: true |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
%{ |
|
|
|
|
|
|
|
title: "POA Sokol", |
|
|
|
|
|
|
|
url: "https://blockscout.com/poa/sokol", |
|
|
|
|
|
|
|
test_net?: true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
describe "dropdown_head_main_nets/0" do |
|
|
|
|
|
|
|
test "get dropdown all main networks except those of 'other' type list based on env variables" do |
|
|
|
|
|
|
|
Application.put_env(:block_scout_web, :other_networks, @supported_chains_pattern) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assert LayoutView.dropdown_head_main_nets() == [ |
|
|
|
|
|
|
|
%{ |
|
|
|
|
|
|
|
title: "POA Core", |
|
|
|
|
|
|
|
url: "https://blockscout.com/poa/core" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
describe "dropdown_other_nets/0" do |
|
|
|
|
|
|
|
test "get dropdown networks of 'other' type list based on env variables" do |
|
|
|
|
|
|
|
Application.put_env(:block_scout_web, :other_networks, @supported_chains_pattern) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assert LayoutView.dropdown_other_nets() == [ |
|
|
|
|
|
|
|
%{ |
|
|
|
|
|
|
|
title: "RSK Mainnet", |
|
|
|
|
|
|
|
url: "https://blockscout.com/rsk/mainnet", |
|
|
|
|
|
|
|
other?: true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|