search_test.go 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package search
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestSearchSetSearchAuditStat(t *testing.T) {
  8. convey.Convey("SetSearchAuditStat", t, func(ctx convey.C) {
  9. var (
  10. c = context.Background()
  11. key = "test"
  12. state bool
  13. )
  14. state = true
  15. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  16. err := d.SetSearchAuditStat(c, key, state)
  17. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  18. ctx.So(err, convey.ShouldBeNil)
  19. })
  20. })
  21. })
  22. }
  23. func TestSearchGetSearchAuditStat(t *testing.T) {
  24. convey.Convey("GetSearchAuditStat", t, func(ctx convey.C) {
  25. var (
  26. c = context.Background()
  27. key = "test"
  28. )
  29. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  30. f, date, err := d.GetSearchAuditStat(c, key)
  31. ctx.Convey("Then err should be nil.f,date should not be nil.", func(ctx convey.C) {
  32. ctx.So(err, convey.ShouldBeNil)
  33. ctx.So(date, convey.ShouldNotBeNil)
  34. ctx.So(f, convey.ShouldNotBeNil)
  35. })
  36. })
  37. })
  38. }