From 89396ebe4450cb29e91c7f6fbc0b4ec74e0f9890 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 11 Jul 2019 15:52:28 +0200 Subject: [PATCH] unit tests added --- tests/unit/document.spec.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/unit/document.spec.js b/tests/unit/document.spec.js index 3f26c3d..52da4e0 100644 --- a/tests/unit/document.spec.js +++ b/tests/unit/document.spec.js @@ -32,4 +32,19 @@ describe('PDFDocument', () => { expect(fontSpy).not.toBeCalled(); }); }); + + describe('document info', () => { + + test('accepts properties with value undefined', () => { + expect(() => new PDFDocument({ info: { Title: undefined }})) + .not.toThrow(new TypeError("Cannot read property 'toString' of undefined")); + }); + + test('accepts properties with value null', () => { + expect(() => new PDFDocument({ info: { Title: null }})) + .not.toThrow(new TypeError("Cannot read property 'toString' of null")); + }); + + }); + });