This repository was archived by the owner on Jan 31, 2022. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313 playerID = "a1ddced8bb20466db456184d9de50346"
1414)
1515
16+ // TestMain is for getting the database connection before testing.
1617func TestMain (m * testing.M ) {
1718 if store == nil {
1819 storeDB := db .GetStore (db2 .TestConfig )
@@ -21,6 +22,7 @@ func TestMain(m *testing.M) {
2122 m .Run ()
2223}
2324
25+ // TestAlts tests the whole alt account management database table.
2426func TestAlts (t * testing.T ) {
2527 t .Run ("AddAlt" , testAddAlt )
2628 t .Run ("GetAlt" , testGetAlt )
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ var playerUUID = "5bce3068e4f3489fb66b5723b2a7cdb1"
1010var authCode string
1111var store * db.AuthTable
1212
13+ // TestMain is for getting the database connection before testing.
1314func TestMain (m * testing.M ) {
1415 if store == nil {
1516 storeDB := db .GetStore (db2 .TestConfig )
@@ -18,6 +19,7 @@ func TestMain(m *testing.M) {
1819 m .Run ()
1920}
2021
22+ // TestAuthCodes tests the whole auth_codes database table.
2123func TestAuthCodes (t * testing.T ) {
2224 t .Run ("NewAuthCode" , testNewAuthCode )
2325 t .Run ("GetAuthCode" , testGetAuthCode )
Original file line number Diff line number Diff line change 55 "time"
66)
77
8+ // TestConfig is the database configuration for testing, please modify before
9+ // testing.
810var TestConfig = db.Config {
911 Host : "localhost" ,
1012 Port : 5432 ,
Original file line number Diff line number Diff line change 1212 store * db.LinksTable
1313)
1414
15+ // TestMain is for getting the database connection before testing.
1516func TestMain (m * testing.M ) {
1617 if store == nil {
1718 storeDB := db .GetStore (db2 .TestConfig )
@@ -20,6 +21,7 @@ func TestMain(m *testing.M) {
2021 m .Run ()
2122}
2223
24+ // TestLinks tests the whole Links table
2325func TestLinks (t * testing.T ) {
2426 t .Run ("NewLink" , testNewLink )
2527 t .Run ("SetLink" , testSetLink )
Original file line number Diff line number Diff line change 55 "testing"
66)
77
8+ // TestGetStore tests connecting to the database.
89func TestGetStore (t * testing.T ) {
910 db .GetStore (TestConfig )
1011}
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ const (
1010 playerUUID = "5bce3068e4f3489fb66b5723b2a7cdb1"
1111)
1212
13+ // TestGetUUID checks if the player name can resolve the linked UUID.
1314func TestGetUUID (t * testing.T ) {
1415 result := common .GetPlayerID (playerName )
1516
@@ -22,6 +23,7 @@ func TestGetUUID(t *testing.T) {
2223 }
2324}
2425
26+ // TestGetName checks if the player UUID can resolve the linked name.
2527func TestGetName (t * testing.T ) {
2628 result := common .GetPlayerName (playerUUID )
2729
You can’t perform that action at this time.
0 commit comments