refactor: rename constructor

This commit is contained in:
Derrick Hammer 2024-01-03 04:00:21 -05:00
parent 208f50324a
commit c44c11d264
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
2 changed files with 4 additions and 4 deletions

View File

@ -18,7 +18,7 @@ type Multihash struct {
FullBytes []byte
}
func NewMultihash(fullBytes []byte) *Multihash {
func New(fullBytes []byte) *Multihash {
return &Multihash{FullBytes: fullBytes}
}
@ -42,7 +42,7 @@ func FromBase64Url(hash string) (*Multihash, error) {
if err != nil {
return nil, err
}
return NewMultihash(ret), nil
return New(ret), nil
}
func (m *Multihash) ToBase64Url() (string, error) {

View File

@ -203,8 +203,8 @@ func TestNewMultihash(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := NewMultihash(tt.args.fullBytes); !reflect.DeepEqual(got, tt.want) {
t.Errorf("NewMultihash() = %v, want %v", got, tt.want)
if got := New(tt.args.fullBytes); !reflect.DeepEqual(got, tt.want) {
t.Errorf("New() = %v, want %v", got, tt.want)
}
})
}