Files
base/pkg/hashids/hashids_test.go
2026-04-10 18:25:21 +03:30

34 lines
588 B
Go

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)
}