Rename allowance to history
This commit is contained in:
parent
e2428f6e9a
commit
274675d02a
@ -323,7 +323,7 @@ func createTestTask(e *httpexpect.Expect) {
|
|||||||
e.POST("/tasks").WithJSON(requestBody).Expect().Status(201)
|
e.POST("/tasks").WithJSON(requestBody).Expect().Status(201)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGetTaskSWhenTasks(t *testing.T) {
|
func TestGetTasksWhenTasks(t *testing.T) {
|
||||||
e := startServer(t)
|
e := startServer(t)
|
||||||
createTestTask(e)
|
createTestTask(e)
|
||||||
|
|
||||||
@ -391,9 +391,9 @@ func TestPutTaskInvalidTaskId(t *testing.T) {
|
|||||||
func TestPostAllowance(t *testing.T) {
|
func TestPostAllowance(t *testing.T) {
|
||||||
e := startServer(t)
|
e := startServer(t)
|
||||||
|
|
||||||
e.POST("/user/1/allowance").WithJSON(PostAllowance{Allowance: 100}).Expect().Status(200)
|
e.POST("/user/1/history").WithJSON(PostAllowance{Allowance: 100}).Expect().Status(200)
|
||||||
e.POST("/user/1/allowance").WithJSON(PostAllowance{Allowance: 20}).Expect().Status(200)
|
e.POST("/user/1/history").WithJSON(PostAllowance{Allowance: 20}).Expect().Status(200)
|
||||||
e.POST("/user/1/allowance").WithJSON(PostAllowance{Allowance: -10}).Expect().Status(200)
|
e.POST("/user/1/history").WithJSON(PostAllowance{Allowance: -10}).Expect().Status(200)
|
||||||
|
|
||||||
response := e.GET("/user/1").Expect().Status(200).JSON().Object()
|
response := e.GET("/user/1").Expect().Status(200).JSON().Object()
|
||||||
response.Value("allowance").Number().IsEqual(100 + 20 - 10)
|
response.Value("allowance").Number().IsEqual(100 + 20 - 10)
|
||||||
@ -402,16 +402,16 @@ func TestPostAllowance(t *testing.T) {
|
|||||||
func TestPostAllowanceInvalidUserId(t *testing.T) {
|
func TestPostAllowanceInvalidUserId(t *testing.T) {
|
||||||
e := startServer(t)
|
e := startServer(t)
|
||||||
|
|
||||||
e.POST("/user/999/allowance").WithJSON(PostAllowance{Allowance: 100}).Expect().
|
e.POST("/user/999/history").WithJSON(PostAllowance{Allowance: 100}).Expect().
|
||||||
Status(404)
|
Status(404)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGetHistory(t *testing.T) {
|
func TestGetHistory(t *testing.T) {
|
||||||
e := startServer(t)
|
e := startServer(t)
|
||||||
|
|
||||||
e.POST("/user/1/allowance").WithJSON(PostAllowance{Allowance: 100}).Expect().Status(200)
|
e.POST("/user/1/history").WithJSON(PostAllowance{Allowance: 100}).Expect().Status(200)
|
||||||
e.POST("/user/1/allowance").WithJSON(PostAllowance{Allowance: 20}).Expect().Status(200)
|
e.POST("/user/1/history").WithJSON(PostAllowance{Allowance: 20}).Expect().Status(200)
|
||||||
e.POST("/user/1/allowance").WithJSON(PostAllowance{Allowance: -10}).Expect().Status(200)
|
e.POST("/user/1/history").WithJSON(PostAllowance{Allowance: -10}).Expect().Status(200)
|
||||||
|
|
||||||
response := e.GET("/user/1/history").Expect().Status(200).JSON().Array()
|
response := e.GET("/user/1/history").Expect().Status(200).JSON().Array()
|
||||||
response.Length().IsEqual(3)
|
response.Length().IsEqual(3)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user