From 8542e94352fe8815e9e12b201d08ca3eb13ddb74 Mon Sep 17 00:00:00 2001 From: Yuki Hattori Date: Tue, 21 Jan 2025 21:57:26 +0900 Subject: [PATCH] Set timeout for tests about soffice --- test/converter.ts | 42 +++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/test/converter.ts b/test/converter.ts index 4bf48913..c1d09d72 100644 --- a/test/converter.ts +++ b/test/converter.ts @@ -1111,27 +1111,35 @@ describe('Converter', () => { timeoutLarge ) - it('throws an error when soffice is not found', async () => { - const err = new CLIError('Error', CLIErrorCode.NOT_FOUND_SOFFICE) + it( + 'throws an error when soffice is not found', + async () => { + const err = new CLIError('Error', CLIErrorCode.NOT_FOUND_SOFFICE) - jest.spyOn(console, 'warn').mockImplementation() - jest.spyOn(sofficeFinder, 'findSOffice').mockRejectedValue(err) + jest.spyOn(console, 'warn').mockImplementation() + jest.spyOn(sofficeFinder, 'findSOffice').mockRejectedValue(err) - const cvt = converter({ pptxEditable: true }) - await expect(() => - cvt.convertFile(new File(onePath)) - ).rejects.toThrow(err) - }) + const cvt = converter({ pptxEditable: true }) + await expect(() => + cvt.convertFile(new File(onePath)) + ).rejects.toThrow(err) + }, + timeout + ) - it('throws an error when soffice is spawned but does not generate a converted file', async () => { - jest.spyOn(console, 'warn').mockImplementation() - jest.spyOn(SOffice.prototype, 'spawn').mockResolvedValue() + it( + 'throws an error when soffice is spawned but does not generate a converted file', + async () => { + jest.spyOn(console, 'warn').mockImplementation() + jest.spyOn(SOffice.prototype, 'spawn').mockResolvedValue() - const cvt = converter({ pptxEditable: true }) - await expect(() => - cvt.convertFile(new File(onePath)) - ).rejects.toThrow('LibreOffice could not convert PPTX internally.') - }) + const cvt = converter({ pptxEditable: true }) + await expect(() => + cvt.convertFile(new File(onePath)) + ).rejects.toThrow('LibreOffice could not convert PPTX internally.') + }, + timeout + ) }) })