go-ethereum/internal/cli/server/chains/chain_test.go
Evgeny Danilenko 9c8bf51f57
Prepare Bor package for testing (#416)
* Limit state sync by gas

* Added logging for state-sync total gas usage

* Added number of event-records in log

* Minor Changes

* Minor Fix

* Adding individual gasUsed

* Minor Fix

* it works

* fix tests

* log wiggle and delay with block number

* log delays as numbers

* linters

* fix tests

* restore linters for the project

* fix linters

* fix

* fix

* fix

* linters

* generation

* fix tests

* remove heimdall wrapper response

* linters

* remove possible collisions

* remove possible collisions

* remove possible collisions

* tests for unique address generation

* generalize set

* bor miner tests got restored

* fixes after CR

* final step and mining test

* fix

* fix e2e

* more tests for Heimdall requests

* fix linters

Co-authored-by: Ferran <ferranbt@protonmail.com>
Co-authored-by: Shivam Sharma <shivam691999@gmail.com>
2022-06-08 16:39:30 +03:00

54 lines
1 KiB
Go

package chains
import (
"testing"
)
func TestChain_ImportFromFile(t *testing.T) {
t.Parallel()
type args struct {
filename string
}
tests := []struct {
name string
args args
wantErr bool
}{
{
name: "ImportFromFile correct json file",
args: args{filename: "test_files/chain_test.json"},
wantErr: false,
},
{
name: "ImportFromFile correct legacy json file",
args: args{filename: "test_files/chain_legacy_test.json"},
wantErr: false,
},
{
name: "ImportFromFile wrong json file",
args: args{filename: "test_files/wrong_chain.json"},
wantErr: true,
},
{
name: "ImportFromFile nonexistent json file",
args: args{filename: "test_files/chain_test_nonexistent.json"},
wantErr: true,
},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
_, err := ImportFromFile(tt.args.filename)
if (err != nil) != tt.wantErr {
t.Errorf("ImportFromFile() error = %v, wantErr %v", err, tt.wantErr)
return
}
})
}
}