initial commit
This commit is contained in:
33
pkg/hashids/hashids_test.go
Normal file
33
pkg/hashids/hashids_test.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package hashids
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestDecodeCode(t *testing.T) {
|
||||
//code := "p5qggj"
|
||||
//code := "37rx8m"
|
||||
//code := "37r9dn"
|
||||
code := "pz9vew"
|
||||
err := os.Setenv("HASH_SALT", "qtyq68eqeqwy")
|
||||
|
||||
res, err := DecodeCode(code)
|
||||
require.NoError(t, err)
|
||||
fmt.Println(res)
|
||||
}
|
||||
|
||||
func TestGenerateCode(t *testing.T) {
|
||||
var productHub, dasht int64 = 1, 2
|
||||
|
||||
err := os.Setenv("HASH_SALT", "qtyq68eqeqwy")
|
||||
require.NoError(t, err)
|
||||
|
||||
phub := GenerateCode(productHub)
|
||||
fmt.Println(phub)
|
||||
dashtID := GenerateCode(dasht)
|
||||
fmt.Println(dashtID)
|
||||
}
|
||||
Reference in New Issue
Block a user