mirror of
https://github.com/halejohn/Cloudreve.git
synced 2026-01-26 09:34:57 +08:00
Test: hash id generate
This commit is contained in:
32
pkg/hashid/hash_test.go
Normal file
32
pkg/hashid/hash_test.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package hashid
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestHashEncode(t *testing.T) {
|
||||
asserts := assert.New(t)
|
||||
|
||||
{
|
||||
res, err := HashEncode([]int{1, 2, 3})
|
||||
asserts.NoError(err)
|
||||
asserts.NotEmpty(res)
|
||||
}
|
||||
|
||||
{
|
||||
res, err := HashEncode([]int{})
|
||||
asserts.Error(err)
|
||||
asserts.Empty(res)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestHashID(t *testing.T) {
|
||||
asserts := assert.New(t)
|
||||
|
||||
{
|
||||
res := HashID(1, ShareID)
|
||||
asserts.NotEmpty(res)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user