From ad4d87a138f43d8824cb0cabd5e4929ae07715d8 Mon Sep 17 00:00:00 2001 From: Julien Neuhart Date: Tue, 23 Jul 2019 16:59:32 +0200 Subject: [PATCH] improving context timeout tests for office and merge printers + test with only one file to convert for the office printer --- internal/pkg/printer/merge_test.go | 2 +- internal/pkg/printer/office_test.go | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/internal/pkg/printer/merge_test.go b/internal/pkg/printer/merge_test.go index 94b6136f..7f18a1e4 100644 --- a/internal/pkg/printer/merge_test.go +++ b/internal/pkg/printer/merge_test.go @@ -34,7 +34,7 @@ func TestMergePrinter(t *testing.T) { // should not be OK as context.Context // should timeout. opts = MergePrinterOptions{ - WaitTimeout: 0.1, + WaitTimeout: 0.0, } p = NewMergePrinter(logger, fpaths, opts) dest = printertest.GenerateDestination() diff --git a/internal/pkg/printer/office_test.go b/internal/pkg/printer/office_test.go index 836fe0d2..d2449dd8 100644 --- a/internal/pkg/printer/office_test.go +++ b/internal/pkg/printer/office_test.go @@ -32,6 +32,17 @@ func TestOfficePrinter(t *testing.T) { assert.Nil(t, err) err = os.RemoveAll(dest) assert.Nil(t, err) + // using one file. + opts = OfficePrinterOptions{ + WaitTimeout: 10.0, + Landscape: false, + } + p = NewOfficePrinter(logger, []string{fpaths[0]}, opts) + dest = printertest.GenerateDestination() + err = p.Print(dest) + assert.Nil(t, err) + err = os.RemoveAll(dest) + assert.Nil(t, err) // options with landscape. opts = OfficePrinterOptions{ WaitTimeout: 10.0, @@ -46,7 +57,7 @@ func TestOfficePrinter(t *testing.T) { // should not be OK as context.Context // should timeout. opts = OfficePrinterOptions{ - WaitTimeout: 1.0, + WaitTimeout: 0.0, Landscape: true, } p = NewOfficePrinter(logger, fpaths, opts)