adding test for printer package

This commit is contained in:
Julien Neuhart
2019-08-18 17:31:07 +02:00
parent 6964124c1b
commit 2fee966fc8
11 changed files with 346 additions and 79 deletions

View File

@@ -5,6 +5,7 @@ import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/thecodingmachine/gotenberg/internal/pkg/conf"
"github.com/thecodingmachine/gotenberg/internal/pkg/xerror"
"github.com/thecodingmachine/gotenberg/internal/pkg/xlog"
"github.com/thecodingmachine/gotenberg/test"
@@ -13,6 +14,7 @@ import (
func TestMergePrinter(t *testing.T) {
var (
logger xlog.Logger = test.DebugLogger()
config conf.Config = conf.DefaultConfig()
fpaths []string = test.MergeFpaths(t)
opts MergePrinterOptions
dest string
@@ -20,9 +22,7 @@ func TestMergePrinter(t *testing.T) {
err error
)
// default options.
opts = MergePrinterOptions{
WaitTimeout: 10.0,
}
opts = DefaultMergePrinterOptions(config)
p = NewMergePrinter(logger, fpaths, opts)
dest = test.GenerateDestination()
err = p.Print(dest)
@@ -31,9 +31,8 @@ func TestMergePrinter(t *testing.T) {
assert.Nil(t, err)
// should not be OK as context.Context
// should timeout.
opts = MergePrinterOptions{
WaitTimeout: 0.0,
}
opts = DefaultMergePrinterOptions(config)
opts.WaitTimeout = 0.0
p = NewMergePrinter(logger, fpaths, opts)
dest = test.GenerateDestination()
err = p.Print(dest)