mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-21 17:21:09 +01:00
16
backend/config/config_test.go
Normal file
16
backend/config/config_test.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
. "github.com/smartystreets/goconvey/convey"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestInitConfig(t *testing.T) {
|
||||
Convey("Test InitConfig func", t, func() {
|
||||
x := InitConfig("")
|
||||
|
||||
Convey("The value should be nil", func() {
|
||||
So(x, ShouldEqual, nil)
|
||||
})
|
||||
})
|
||||
}
|
||||
19
backend/database/mongo_test.go
Normal file
19
backend/database/mongo_test.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package database
|
||||
|
||||
import (
|
||||
. "github.com/smartystreets/goconvey/convey"
|
||||
"github.com/spf13/viper"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestGetDb(t *testing.T) {
|
||||
Convey("Test GetDb", t, func() {
|
||||
s, db := GetDb()
|
||||
Convey("The value should be Session.Copy", func() {
|
||||
So(s, ShouldEqual, Session.Copy())
|
||||
})
|
||||
Convey("The value should be reference of database", func() {
|
||||
So(db, ShouldEqual, s.DB(viper.GetString("mongo.db")))
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -11,5 +11,6 @@ require (
|
||||
github.com/gomodule/redigo v2.0.0+incompatible
|
||||
github.com/pkg/errors v0.8.1
|
||||
github.com/satori/go.uuid v1.2.0
|
||||
github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337
|
||||
github.com/spf13/viper v1.4.0
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user