Skip to content

Commit

Permalink
Add test case for Import from file
Browse files Browse the repository at this point in the history
  • Loading branch information
0xKrishna authored and Victor Castell committed May 9, 2022
1 parent b398409 commit d7ebe2f
Show file tree
Hide file tree
Showing 2 changed files with 128 additions and 0 deletions.
36 changes: 36 additions & 0 deletions internal/cli/server/chains/chain_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package chains

import (
"testing"
)

func TestImportFromFile(t *testing.T) {
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 nonexistent json file",
args: args{filename: "test_files/chain_test_nonexistent.json"},
wantErr: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
_, err := ImportFromFile(tt.args.filename)
if (err != nil) != tt.wantErr {
t.Errorf("ImportFromFile() error = %v, wantErr %v", err, tt.wantErr)
return
}
})
}
}
Loading

0 comments on commit d7ebe2f

Please sign in to comment.