Add test case for Import from file

This commit is contained in:
Krishna Upadhyaya 2022-01-24 11:26:31 +05:30 committed by Victor Castell
parent b3984096e2
commit d7ebe2fca1
2 changed files with 128 additions and 0 deletions

View file

@ -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
}
})
}
}

File diff suppressed because one or more lines are too long