正在显示
4 个修改的文件
包含
39 行增加
和
40 行删除
1 | +package user | ||
1 | 2 | ||
2 | -package user-favorite-menus | ||
3 | import ( | 3 | import ( |
4 | -"github.com/gavv/httpexpect" | ||
5 | -"github.com/go-pg/pg/v10" | ||
6 | -pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/infrastructure/pg" | ||
7 | -. "github.com/onsi/ginkgo" | ||
8 | -. "github.com/onsi/gomega" | ||
9 | -"net/http" | 4 | + "github.com/gavv/httpexpect" |
5 | + "github.com/go-pg/pg/v10" | ||
6 | + . "github.com/onsi/ginkgo" | ||
7 | + . "github.com/onsi/gomega" | ||
8 | + pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/infrastructure/pg" | ||
9 | + "net/http" | ||
10 | ) | 10 | ) |
11 | 11 | ||
12 | var _ = Describe("移除我收藏的菜单", func() { | 12 | var _ = Describe("移除我收藏的菜单", func() { |
@@ -29,7 +29,7 @@ var _ = Describe("移除我收藏的菜单", func() { | @@ -29,7 +29,7 @@ var _ = Describe("移除我收藏的菜单", func() { | ||
29 | Object(). | 29 | Object(). |
30 | ContainsKey("code").ValueEqual("code", 0). | 30 | ContainsKey("code").ValueEqual("code", 0). |
31 | ContainsKey("msg").ValueEqual("msg", "ok"). | 31 | ContainsKey("msg").ValueEqual("msg", "ok"). |
32 | - ContainsKey("data").Value("data").Object() | 32 | + ContainsKey("data").Value("data").Object() |
33 | }) | 33 | }) |
34 | }) | 34 | }) |
35 | }) | 35 | }) |
@@ -37,4 +37,4 @@ var _ = Describe("移除我收藏的菜单", func() { | @@ -37,4 +37,4 @@ var _ = Describe("移除我收藏的菜单", func() { | ||
37 | _, err := pG.DB.Exec("DELETE FROM users WHERE true") | 37 | _, err := pG.DB.Exec("DELETE FROM users WHERE true") |
38 | Expect(err).NotTo(HaveOccurred()) | 38 | Expect(err).NotTo(HaveOccurred()) |
39 | }) | 39 | }) |
40 | -}) | ||
40 | +}) |
1 | +package user | ||
1 | 2 | ||
2 | -package user-favorite-menus | ||
3 | import ( | 3 | import ( |
4 | -"github.com/gavv/httpexpect" | ||
5 | -"github.com/go-pg/pg/v10" | ||
6 | -pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/infrastructure/pg" | ||
7 | -. "github.com/onsi/ginkgo" | ||
8 | -. "github.com/onsi/gomega" | ||
9 | -"net/http" | 4 | + "github.com/gavv/httpexpect" |
5 | + "github.com/go-pg/pg/v10" | ||
6 | + . "github.com/onsi/ginkgo" | ||
7 | + . "github.com/onsi/gomega" | ||
8 | + pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/infrastructure/pg" | ||
9 | + "net/http" | ||
10 | ) | 10 | ) |
11 | 11 | ||
12 | var _ = Describe("获取我收藏的菜单", func() { | 12 | var _ = Describe("获取我收藏的菜单", func() { |
@@ -29,7 +29,7 @@ var _ = Describe("获取我收藏的菜单", func() { | @@ -29,7 +29,7 @@ var _ = Describe("获取我收藏的菜单", func() { | ||
29 | Object(). | 29 | Object(). |
30 | ContainsKey("code").ValueEqual("code", 0). | 30 | ContainsKey("code").ValueEqual("code", 0). |
31 | ContainsKey("msg").ValueEqual("msg", "ok"). | 31 | ContainsKey("msg").ValueEqual("msg", "ok"). |
32 | - ContainsKey("data").Value("data").Object() | 32 | + ContainsKey("data").Value("data").Object() |
33 | }) | 33 | }) |
34 | }) | 34 | }) |
35 | }) | 35 | }) |
@@ -37,4 +37,4 @@ var _ = Describe("获取我收藏的菜单", func() { | @@ -37,4 +37,4 @@ var _ = Describe("获取我收藏的菜单", func() { | ||
37 | _, err := pG.DB.Exec("DELETE FROM users WHERE true") | 37 | _, err := pG.DB.Exec("DELETE FROM users WHERE true") |
38 | Expect(err).NotTo(HaveOccurred()) | 38 | Expect(err).NotTo(HaveOccurred()) |
39 | }) | 39 | }) |
40 | -}) | ||
40 | +}) |
1 | +package user | ||
1 | 2 | ||
2 | -package user-favorite-menus | ||
3 | import ( | 3 | import ( |
4 | -"github.com/gavv/httpexpect" | ||
5 | -"github.com/go-pg/pg/v10" | ||
6 | -pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/infrastructure/pg" | ||
7 | -. "github.com/onsi/ginkgo" | ||
8 | -. "github.com/onsi/gomega" | ||
9 | -"net/http" | 4 | + "github.com/gavv/httpexpect" |
5 | + "github.com/go-pg/pg/v10" | ||
6 | + . "github.com/onsi/ginkgo" | ||
7 | + . "github.com/onsi/gomega" | ||
8 | + pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/infrastructure/pg" | ||
9 | + "net/http" | ||
10 | ) | 10 | ) |
11 | 11 | ||
12 | var _ = Describe("更新我喜欢菜单列表", func() { | 12 | var _ = Describe("更新我喜欢菜单列表", func() { |
@@ -22,18 +22,18 @@ var _ = Describe("更新我喜欢菜单列表", func() { | @@ -22,18 +22,18 @@ var _ = Describe("更新我喜欢菜单列表", func() { | ||
22 | Context("", func() { | 22 | Context("", func() { |
23 | It("", func() { | 23 | It("", func() { |
24 | httpExpect := httpexpect.New(GinkgoT(), server.URL) | 24 | httpExpect := httpexpect.New(GinkgoT(), server.URL) |
25 | - body := map[string]interface{}{ | 25 | + body := map[string]interface{}{ |
26 | "favoriteMenus": "array", | 26 | "favoriteMenus": "array", |
27 | } | 27 | } |
28 | httpExpect.PUT("/user/{userId}/favorite-menus"). | 28 | httpExpect.PUT("/user/{userId}/favorite-menus"). |
29 | - WithJSON(body). | 29 | + WithJSON(body). |
30 | Expect(). | 30 | Expect(). |
31 | Status(http.StatusOK). | 31 | Status(http.StatusOK). |
32 | JSON(). | 32 | JSON(). |
33 | Object(). | 33 | Object(). |
34 | ContainsKey("code").ValueEqual("code", 0). | 34 | ContainsKey("code").ValueEqual("code", 0). |
35 | ContainsKey("msg").ValueEqual("msg", "ok"). | 35 | ContainsKey("msg").ValueEqual("msg", "ok"). |
36 | - ContainsKey("data").Value("data").Object() | 36 | + ContainsKey("data").Value("data").Object() |
37 | }) | 37 | }) |
38 | }) | 38 | }) |
39 | }) | 39 | }) |
@@ -41,4 +41,4 @@ var _ = Describe("更新我喜欢菜单列表", func() { | @@ -41,4 +41,4 @@ var _ = Describe("更新我喜欢菜单列表", func() { | ||
41 | _, err := pG.DB.Exec("DELETE FROM users WHERE true") | 41 | _, err := pG.DB.Exec("DELETE FROM users WHERE true") |
42 | Expect(err).NotTo(HaveOccurred()) | 42 | Expect(err).NotTo(HaveOccurred()) |
43 | }) | 43 | }) |
44 | -}) | ||
44 | +}) |
1 | +package user | ||
1 | 2 | ||
2 | -package user-favorite-menus | ||
3 | import ( | 3 | import ( |
4 | -"github.com/beego/beego/v2/server/web" | ||
5 | -. "github.com/onsi/ginkgo" | ||
6 | -. "github.com/onsi/gomega" | ||
7 | -"net/http" | ||
8 | -"net/http/httptest" | ||
9 | -_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/application" | ||
10 | -_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/infrastructure/pg" | ||
11 | -_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/port/beego" | ||
12 | -"testing" | 4 | + "github.com/beego/beego/v2/server/web" |
5 | + . "github.com/onsi/ginkgo" | ||
6 | + . "github.com/onsi/gomega" | ||
7 | + _ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/infrastructure/pg" | ||
8 | + _ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/port/beego" | ||
9 | + "net/http" | ||
10 | + "net/http/httptest" | ||
11 | + "testing" | ||
13 | ) | 12 | ) |
14 | 13 | ||
15 | func TestUserFavoriteMenus(t *testing.T) { | 14 | func TestUserFavoriteMenus(t *testing.T) { |
@@ -27,4 +26,4 @@ var _ = BeforeSuite(func() { | @@ -27,4 +26,4 @@ var _ = BeforeSuite(func() { | ||
27 | 26 | ||
28 | var _ = AfterSuite(func() { | 27 | var _ = AfterSuite(func() { |
29 | server.Close() | 28 | server.Close() |
30 | -}) | ||
29 | +}) |
-
请 注册 或 登录 后发表评论