Passed
Pull Request — main (#166)
by Yume
02:21
created

infrastructures_test.TestGetDBConnInstance   A

Complexity

Conditions 3

Size

Total Lines 15
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 7
nop 1
dl 0
loc 15
rs 10
c 0
b 0
f 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
	}
25
}
26