Total Lines | 23 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | package infrastructures_test |
||
2 | |||
3 | import ( |
||
4 | "testing" |
||
5 | |||
6 | "github.com/memnix/memnix-rest/infrastructures" |
||
7 | ) |
||
8 | |||
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 |