mirror of
https://github.com/gotenberg/gotenberg.git
synced 2026-08-16 20:32:13 +01:00
adding first tests + small refactoring for tests
This commit is contained in:
30
app/app_test.go
Normal file
30
app/app_test.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestNewApp(t *testing.T) {
|
||||
// case 1: uses an empty configuration file path.
|
||||
if _, err := NewApp("tests", ""); err == nil {
|
||||
t.Error("App should not have been instantiated!")
|
||||
}
|
||||
|
||||
// case 2: uses an correct configuration file.
|
||||
path, _ := filepath.Abs("../_tests/configurations/gotenberg.yml")
|
||||
if _, err := NewApp("tests", path); err != nil {
|
||||
t.Error("App should have been instantiated!")
|
||||
}
|
||||
}
|
||||
|
||||
func TestRun(t *testing.T) {
|
||||
path, _ := filepath.Abs("../_tests/configurations/gotenberg.yml")
|
||||
a, _ := NewApp("tests", path)
|
||||
|
||||
quit := make(chan bool, 1)
|
||||
go func() {
|
||||
a.Run()
|
||||
}()
|
||||
quit <- true
|
||||
}
|
||||
Reference in New Issue
Block a user