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

infrastructures/sql_test.go   A

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 11
dl 0
loc 23
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A infrastructures_test.TestGetDBConnInstance 0 15 3
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