test: update test signatures to match new test_helpers.go
- Remove handler parameter from test function calls - Update test signatures to use new return values from setupTestServer - Fix compilation errors after test helper refactoring - Maintain test functionality while simplifying setup
This commit is contained in:
@@ -14,7 +14,7 @@ import (
|
||||
// TestCollectionsBulkOperations tests bulk collection operations
|
||||
func TestCollectionsBulkOperations(t *testing.T) {
|
||||
t.Run("BulkAddBooks_WithoutAuth", func(t *testing.T) {
|
||||
ts, _, _, _ := setupTestServer(t)
|
||||
ts, _, _ := setupTestServer(t)
|
||||
defer ts.Close()
|
||||
|
||||
req := map[string]interface{}{
|
||||
@@ -39,7 +39,7 @@ func TestCollectionsBulkOperations(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("BulkAddBooks_EmptyOperations", func(t *testing.T) {
|
||||
ts, db, _, _ := setupTestServer(t)
|
||||
ts, db, _ := setupTestServer(t)
|
||||
defer ts.Close()
|
||||
|
||||
token := loginTestUser(t, ts, db)
|
||||
@@ -62,7 +62,7 @@ func TestCollectionsBulkOperations(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("BulkAddBooks_InvalidCollectionID", func(t *testing.T) {
|
||||
ts, db, _, _ := setupTestServer(t)
|
||||
ts, db, _ := setupTestServer(t)
|
||||
defer ts.Close()
|
||||
|
||||
token := loginTestUser(t, ts, db)
|
||||
@@ -105,7 +105,7 @@ func TestCollectionsBulkOperations(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("BulkAddBooks_InvalidBookID", func(t *testing.T) {
|
||||
ts, db, _, _ := setupTestServer(t)
|
||||
ts, db, _ := setupTestServer(t)
|
||||
defer ts.Close()
|
||||
|
||||
token := loginTestUser(t, ts, db)
|
||||
@@ -160,7 +160,7 @@ func TestCollectionsBulkOperations(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("BulkAddBooks_SingleOperation", func(t *testing.T) {
|
||||
ts, db, _, _ := setupTestServer(t)
|
||||
ts, db, _ := setupTestServer(t)
|
||||
defer ts.Close()
|
||||
|
||||
token := loginTestUser(t, ts, db)
|
||||
@@ -223,7 +223,7 @@ func TestCollectionsBulkOperations(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("BulkAddBooks_MultipleBooksSingleCollection", func(t *testing.T) {
|
||||
ts, db, _, _ := setupTestServer(t)
|
||||
ts, db, _ := setupTestServer(t)
|
||||
defer ts.Close()
|
||||
|
||||
token := loginTestUser(t, ts, db)
|
||||
@@ -277,12 +277,12 @@ func TestCollectionsBulkOperations(t *testing.T) {
|
||||
var result map[string]interface{}
|
||||
json.NewDecoder(resp.Body).Decode(&result)
|
||||
|
||||
assert.Equal(t, 3, result["total"])
|
||||
assert.Equal(t, 3, getJSONInt(result["total"]))
|
||||
assert.True(t, result["success"].(float64) > 0)
|
||||
})
|
||||
|
||||
t.Run("BulkAddBooks_MultipleCollections", func(t *testing.T) {
|
||||
ts, db, _, _ := setupTestServer(t)
|
||||
ts, db, _ := setupTestServer(t)
|
||||
defer ts.Close()
|
||||
|
||||
token := loginTestUser(t, ts, db)
|
||||
@@ -358,11 +358,11 @@ func TestCollectionsBulkOperations(t *testing.T) {
|
||||
json.NewDecoder(resp.Body).Decode(&result)
|
||||
|
||||
assert.Contains(t, result, "results")
|
||||
assert.Equal(t, 3, result["total"])
|
||||
assert.Equal(t, 3, getJSONInt(result["total"]))
|
||||
})
|
||||
|
||||
t.Run("BulkAddBooks_DuplicateBooks", func(t *testing.T) {
|
||||
ts, db, _, _ := setupTestServer(t)
|
||||
ts, db, _ := setupTestServer(t)
|
||||
defer ts.Close()
|
||||
|
||||
token := loginTestUser(t, ts, db)
|
||||
@@ -419,7 +419,7 @@ func TestCollectionsBulkOperations(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("BulkAddBooks_InvalidRequestBody", func(t *testing.T) {
|
||||
ts, db, _, _ := setupTestServer(t)
|
||||
ts, db, _ := setupTestServer(t)
|
||||
defer ts.Close()
|
||||
|
||||
token := loginTestUser(t, ts, db)
|
||||
|
||||
Reference in New Issue
Block a user