utils_test.go 520 B

1234567891011121314151617181920212223
  1. package common_test
  2. import (
  3. "testing"
  4. "github.com/labring/aiproxy/core/common"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestShortUUID(t *testing.T) {
  8. convey.Convey("ShortUUID", t, func() {
  9. convey.Convey("should return a 32-character hex string", func() {
  10. uid := common.ShortUUID()
  11. convey.So(len(uid), convey.ShouldEqual, 32)
  12. })
  13. convey.Convey("should be unique", func() {
  14. uid1 := common.ShortUUID()
  15. uid2 := common.ShortUUID()
  16. convey.So(uid1, convey.ShouldNotEqual, uid2)
  17. })
  18. })
  19. }