mirror of
https://github.com/bitechdev/ResolveSpec.git
synced 2026-01-01 01:34:25 +00:00
Added x-files feature
This commit is contained in:
@@ -372,7 +372,14 @@ func testRestHeadSpecCRUD(t *testing.T, serverURL string) {
|
||||
|
||||
var result map[string]interface{}
|
||||
json.NewDecoder(resp.Body).Decode(&result)
|
||||
assert.True(t, result["success"].(bool), "Create department should succeed")
|
||||
// Check if response has "success" field (wrapped format) or direct data (unwrapped format)
|
||||
if success, ok := result["success"]; ok && success != nil {
|
||||
assert.True(t, success.(bool), "Create department should succeed")
|
||||
} else {
|
||||
// Unwrapped format - verify we got the created data back
|
||||
assert.NotEmpty(t, result, "Create department should return data")
|
||||
assert.Equal(t, deptID, result["id"], "Created department should have correct ID")
|
||||
}
|
||||
logger.Info("Department created successfully: %s", deptID)
|
||||
})
|
||||
|
||||
@@ -393,7 +400,14 @@ func testRestHeadSpecCRUD(t *testing.T, serverURL string) {
|
||||
|
||||
var result map[string]interface{}
|
||||
json.NewDecoder(resp.Body).Decode(&result)
|
||||
assert.True(t, result["success"].(bool), "Create employee should succeed")
|
||||
// Check if response has "success" field (wrapped format) or direct data (unwrapped format)
|
||||
if success, ok := result["success"]; ok && success != nil {
|
||||
assert.True(t, success.(bool), "Create employee should succeed")
|
||||
} else {
|
||||
// Unwrapped format - verify we got the created data back
|
||||
assert.NotEmpty(t, result, "Create employee should return data")
|
||||
assert.Equal(t, empID, result["id"], "Created employee should have correct ID")
|
||||
}
|
||||
logger.Info("Employee created successfully: %s", empID)
|
||||
})
|
||||
|
||||
@@ -540,7 +554,13 @@ func testRestHeadSpecCRUD(t *testing.T, serverURL string) {
|
||||
|
||||
var result map[string]interface{}
|
||||
json.NewDecoder(resp.Body).Decode(&result)
|
||||
assert.True(t, result["success"].(bool), "Update department should succeed")
|
||||
// Check if response has "success" field (wrapped format) or direct data (unwrapped format)
|
||||
if success, ok := result["success"]; ok && success != nil {
|
||||
assert.True(t, success.(bool), "Update department should succeed")
|
||||
} else {
|
||||
// Unwrapped format - verify we got the updated data back
|
||||
assert.NotEmpty(t, result, "Update department should return data")
|
||||
}
|
||||
logger.Info("Department updated successfully: %s", deptID)
|
||||
|
||||
// Verify update by reading the department again
|
||||
@@ -558,7 +578,13 @@ func testRestHeadSpecCRUD(t *testing.T, serverURL string) {
|
||||
|
||||
var result map[string]interface{}
|
||||
json.NewDecoder(resp.Body).Decode(&result)
|
||||
assert.True(t, result["success"].(bool), "Update employee should succeed")
|
||||
// Check if response has "success" field (wrapped format) or direct data (unwrapped format)
|
||||
if success, ok := result["success"]; ok && success != nil {
|
||||
assert.True(t, success.(bool), "Update employee should succeed")
|
||||
} else {
|
||||
// Unwrapped format - verify we got the updated data back
|
||||
assert.NotEmpty(t, result, "Update employee should return data")
|
||||
}
|
||||
logger.Info("Employee updated successfully: %s", empID)
|
||||
})
|
||||
|
||||
@@ -569,7 +595,13 @@ func testRestHeadSpecCRUD(t *testing.T, serverURL string) {
|
||||
|
||||
var result map[string]interface{}
|
||||
json.NewDecoder(resp.Body).Decode(&result)
|
||||
assert.True(t, result["success"].(bool), "Delete employee should succeed")
|
||||
// Check if response has "success" field (wrapped format) or direct data (unwrapped format)
|
||||
if success, ok := result["success"]; ok && success != nil {
|
||||
assert.True(t, success.(bool), "Delete employee should succeed")
|
||||
} else {
|
||||
// Unwrapped format - verify we got a response (typically {"deleted": count})
|
||||
assert.NotEmpty(t, result, "Delete employee should return data")
|
||||
}
|
||||
logger.Info("Employee deleted successfully: %s", empID)
|
||||
|
||||
// Verify deletion - just log that delete succeeded
|
||||
@@ -582,7 +614,13 @@ func testRestHeadSpecCRUD(t *testing.T, serverURL string) {
|
||||
|
||||
var result map[string]interface{}
|
||||
json.NewDecoder(resp.Body).Decode(&result)
|
||||
assert.True(t, result["success"].(bool), "Delete department should succeed")
|
||||
// Check if response has "success" field (wrapped format) or direct data (unwrapped format)
|
||||
if success, ok := result["success"]; ok && success != nil {
|
||||
assert.True(t, success.(bool), "Delete department should succeed")
|
||||
} else {
|
||||
// Unwrapped format - verify we got a response (typically {"deleted": count})
|
||||
assert.NotEmpty(t, result, "Delete department should return data")
|
||||
}
|
||||
logger.Info("Department deleted successfully: %s", deptID)
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user