Initial cloud-services repo - gateway service + pkg modules

This commit is contained in:
Chris Rai
2026-01-30 23:14:52 -05:00
commit fbb820d7b3
1037 changed files with 171318 additions and 0 deletions

81
pkg/mongo/client_test.go Normal file
View File

@@ -0,0 +1,81 @@
package mongo_test
import (
"testing"
"fiskerinc.com/modules/mongo"
"fiskerinc.com/modules/testhelper"
)
func TestNewClient(t *testing.T) {
_, err := mongo.NewClient(mongo.StandardDB)
if err != nil {
t.Errorf(testhelper.TestErrorTemplate, "TestNewClient", nil, err)
}
}
func TestClientGetVehicles(t *testing.T) {
client, err := mongo.NewClient(mongo.StandardDB)
if err != nil {
t.Errorf(testhelper.TestErrorTemplate, "TestClientGetVehicles", nil, err)
}
client.GetVehicles()
}
func TestClientSetVehicles(t *testing.T) {
client, err := mongo.NewClient(mongo.StandardDB)
if err != nil {
t.Errorf(testhelper.TestErrorTemplate, "TestClientSetVehicles", nil, err)
}
client.SetVehicles(mongo.NewVehiclesCollection(
mongo.NewCollection(client.Collection("vehicles")),
))
}
func TestClientGetFleets(t *testing.T) {
client, err := mongo.NewClient(mongo.StandardDB)
if err != nil {
t.Errorf(testhelper.TestErrorTemplate, "TestClientGetFleets", nil, err)
}
client.GetFleets()
}
func TestClientSetFleets(t *testing.T) {
client, err := mongo.NewClient(mongo.StandardDB)
if err != nil {
t.Errorf(testhelper.TestErrorTemplate, "TestClientSetFleets", nil, err)
}
client.SetFleets(mongo.NewFleetsCollection(
mongo.NewCollection(client.Collection("fleets")),
))
}
func TestClientCollection(t *testing.T) {
client, err := mongo.NewClient(mongo.StandardDB)
if err != nil {
t.Errorf(testhelper.TestErrorTemplate, "TestClientCollection", nil, err)
return
}
c := client.Collection("test")
if c == nil {
t.Errorf(testhelper.TestErrorTemplate, "TestClientCollection", "*mongo.Collection", c)
}
}
func TestClientClose(t *testing.T) {
client, err := mongo.NewClient(mongo.StandardDB)
if err != nil {
t.Errorf(testhelper.TestErrorTemplate, "TestClientClose", nil, err)
return
}
err = client.Close()
if err != nil {
t.Errorf(testhelper.TestErrorTemplate, "TestClientClose", nil, err)
}
}