github.com/condensat/bank-core@v0.1.0/database/model/ssmaddressinfo_test.go (about) 1 // Copyright 2020 Condensat Tech. All rights reserved. 2 // Use of this source code is governed by a MIT 3 // license that can be found in the LICENSE file. 4 5 package model 6 7 import "testing" 8 9 func TestSsmAddressInfo_IsValid(t *testing.T) { 10 type fields struct { 11 SsmAddressID SsmAddressID 12 Chain SsmChain 13 Fingerprint SsmFingerprint 14 HDPath SsmHDPath 15 } 16 tests := []struct { 17 name string 18 fields fields 19 want bool 20 }{ 21 {"Default", fields{}, false}, 22 {"InvalidID", fields{0, "chain", "fingerprint", "path"}, false}, 23 {"InvalidChain", fields{42, "", "fingerprint", "path"}, false}, 24 {"InvalidFingerprint", fields{42, "chain", "", "path"}, false}, 25 {"InvalidPath", fields{42, "chain", "fingerprint", ""}, false}, 26 27 {"Valid", fields{42, "chain", "fingerprint", "path"}, true}, 28 } 29 for _, tt := range tests { 30 t.Run(tt.name, func(t *testing.T) { 31 p := &SsmAddressInfo{ 32 SsmAddressID: tt.fields.SsmAddressID, 33 Chain: tt.fields.Chain, 34 Fingerprint: tt.fields.Fingerprint, 35 HDPath: tt.fields.HDPath, 36 } 37 if got := p.IsValid(); got != tt.want { 38 t.Errorf("SsmAddressInfo.IsValid() = %v, want %v", got, tt.want) 39 } 40 }) 41 } 42 }