diff --git a/cmd/server/tests/integration_test.go b/cmd/server/tests/integration_test.go index 0d9787a..6c323a9 100644 --- a/cmd/server/tests/integration_test.go +++ b/cmd/server/tests/integration_test.go @@ -285,16 +285,14 @@ func setupTestSuite(t *testing.T) *TestContext { resp = makeRequest(t, "POST", "/api/libraries", libReq, ctx.AdminToken) defer resp.Body.Close() - if resp.StatusCode == http.StatusCreated || resp.StatusCode == http.StatusOK { - var lib map[string]interface{} - body, _ := io.ReadAll(resp.Body) - err := json.Unmarshal(body, &lib) - require.NoError(t, err) + require.Equal(t, http.StatusCreated, resp.StatusCode, "Failed to create library") - ctx.LibraryID = lib["id"].(string) - t.Logf("Created new library: %v", lib["name"]) - } + var lib map[string]interface{} + body, _ := io.ReadAll(resp.Body) + err := json.Unmarshal(body, &lib) + require.NoError(t, err) + ctx.LibraryID = lib["id"].(string) require.NotEmpty(t, ctx.LibraryID, "Library ID is empty") })