From 4ce18938a5f16482a940f3e057b707508e52331e Mon Sep 17 00:00:00 2001 From: Daniel F Date: Tue, 11 Jul 2023 23:23:34 +0100 Subject: [PATCH] Added ItemControllerTestr --- go/api/controllers/item_controller_test.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/go/api/controllers/item_controller_test.go b/go/api/controllers/item_controller_test.go index 2bf6e902..66de4067 100644 --- a/go/api/controllers/item_controller_test.go +++ b/go/api/controllers/item_controller_test.go @@ -46,3 +46,17 @@ func TestInvalidItem(t *testing.T) { assert.Equal(t, 400, w.Code) }) } + +func TestValidItem(t *testing.T) { + runTestCase(t, func( + handler lib.RequestHandler, + ) { + req, _ := http.NewRequest("POST", "/update_quality", strings.NewReader(` + { "days": 1, "items": [{ "name": "Random normal item", "quality": 5, "sellIn": 5}]} + `)) + req.Header = map[string][]string{"Content-Type": {"application/json"}} + + w := executeRequest(handler, req) + assert.Equal(t, 200, w.Code) + }) +}