summary_test.go 756 B

123456789101112131415161718192021222324252627282930313233343536
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestDaoSave(t *testing.T) {
  8. var (
  9. // ctx = context.Background()·
  10. key = ""
  11. data map[string][]byte
  12. )
  13. convey.Convey("Save", t, func(ctx convey.C) {
  14. err := d.Save(context.TODO(), key, data)
  15. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  16. ctx.So(err, convey.ShouldBeNil)
  17. })
  18. })
  19. }
  20. func TestDaoGetByKey(t *testing.T) {
  21. var (
  22. // ctx = context.Background()
  23. key = ""
  24. )
  25. convey.Convey("GetByKey", t, func(ctx convey.C) {
  26. p1, err := d.GetByKey(context.TODO(), key)
  27. ctx.Convey("Then err should be nil.p1 should not be nil.", func(ctx convey.C) {
  28. ctx.So(err, convey.ShouldBeNil)
  29. ctx.So(p1, convey.ShouldNotBeNil)
  30. })
  31. })
  32. }