mirror of
https://github.com/gotenberg/gotenberg.git
synced 2026-08-16 20:32:13 +01:00
chore(unoconv): improve code coverage
This commit is contained in:
@@ -89,15 +89,18 @@ func TestUnoconv_Unoconv(t *testing.T) {
|
|||||||
func TestUnoconv_PDF(t *testing.T) {
|
func TestUnoconv_PDF(t *testing.T) {
|
||||||
for i, tc := range []struct {
|
for i, tc := range []struct {
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
|
logger *zap.Logger
|
||||||
inputPath string
|
inputPath string
|
||||||
options Options
|
options Options
|
||||||
expectErr bool
|
expectErr bool
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
|
logger: zap.NewNop(),
|
||||||
expectErr: true,
|
expectErr: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ctx: context.Background(),
|
ctx: context.Background(),
|
||||||
|
logger: zap.NewExample(),
|
||||||
inputPath: "/tests/test/testdata/libreoffice/sample1.docx",
|
inputPath: "/tests/test/testdata/libreoffice/sample1.docx",
|
||||||
options: Options{
|
options: Options{
|
||||||
Landscape: true,
|
Landscape: true,
|
||||||
@@ -107,6 +110,7 @@ func TestUnoconv_PDF(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
ctx: context.Background(),
|
ctx: context.Background(),
|
||||||
|
logger: zap.NewNop(),
|
||||||
inputPath: "/tests/test/testdata/libreoffice/sample1.docx",
|
inputPath: "/tests/test/testdata/libreoffice/sample1.docx",
|
||||||
options: Options{
|
options: Options{
|
||||||
PageRanges: "foo",
|
PageRanges: "foo",
|
||||||
@@ -120,6 +124,7 @@ func TestUnoconv_PDF(t *testing.T) {
|
|||||||
|
|
||||||
return ctx
|
return ctx
|
||||||
}(),
|
}(),
|
||||||
|
logger: zap.NewNop(),
|
||||||
inputPath: "/tests/test/testdata/libreoffice/sample1.docx",
|
inputPath: "/tests/test/testdata/libreoffice/sample1.docx",
|
||||||
expectErr: true,
|
expectErr: true,
|
||||||
},
|
},
|
||||||
@@ -144,7 +149,7 @@ func TestUnoconv_PDF(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
err = mod.PDF(tc.ctx, zap.NewNop(), tc.inputPath, outputDir+"/foo.pdf", tc.options)
|
err = mod.PDF(tc.ctx, tc.logger, tc.inputPath, outputDir+"/foo.pdf", tc.options)
|
||||||
|
|
||||||
if tc.expectErr && err == nil {
|
if tc.expectErr && err == nil {
|
||||||
t.Errorf("test %d: expected error but got: %v", i, err)
|
t.Errorf("test %d: expected error but got: %v", i, err)
|
||||||
|
|||||||
Reference in New Issue
Block a user