github.com/TrueBlocks/trueblocks-core/src/apps/chifra@v0.0.0-20241022031540-b362680128f7/pkg/pinning/is_valid_test.go (about) 1 package pinning 2 3 import ( 4 "testing" 5 ) 6 7 func TestIsValid(t *testing.T) { 8 tests := []struct { 9 needle string 10 isValid bool 11 }{ 12 { 13 needle: "not-a-cid", 14 isValid: false, 15 }, 16 { 17 needle: "QmZ1", 18 isValid: false, 19 }, 20 { 21 needle: "QmUjPmAWTbvmdbWKivhamp9yuRCtQtVsEjnncojamNqFd4", 22 isValid: true, 23 }, 24 } 25 for _, test := range tests { 26 isValid := IsValid(test.needle) 27 if isValid != test.isValid { 28 t.Errorf("Expected %v, got %v", test.isValid, isValid) 29 } 30 } 31 }