| Conditions | 3 |
| Total Lines | 15 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | package infrastructures_test |
||
| 9 | func TestGetDBConnInstance(t *testing.T) { |
||
| 10 | // Call GetDBConnInstance |
||
| 11 | dbInstance := infrastructures.GetDBConnInstance() |
||
| 12 | |||
| 13 | // Check if the returned instance is not nil |
||
| 14 | if dbInstance == nil { |
||
| 15 | t.Error("Failed to get DB connection instance") |
||
| 16 | } |
||
| 17 | |||
| 18 | // Call GetDBConnInstance again |
||
| 19 | dbInstance2 := infrastructures.GetDBConnInstance() |
||
| 20 | |||
| 21 | // Check if the second instance is the same as the first instance |
||
| 22 | if dbInstance != dbInstance2 { |
||
| 23 | t.Error("DB connection instances are not the same") |
||
| 24 | } |
||
| 26 |