diff --git a/tests/unit/font.spec.js b/tests/unit/font.spec.js index 09bc5b2..f8cc94d 100644 --- a/tests/unit/font.spec.js +++ b/tests/unit/font.spec.js @@ -33,4 +33,23 @@ describe('EmbeddedFont', () => { expect(runSpy).toBeCalledTimes(4); }); + + describe('emebed', () => { + test('sets BaseName based on font id and postscript name', () => { + const document = new PDFDocument(); + const font = PDFFontFactory.open( + document, + 'tests/fonts/Roboto-Regular.ttf', + undefined, + 'F1099' + ); + const dictionary = { + end: () => {}, + }; + font.dictionary = dictionary; + font.embed(); + + expect(dictionary.data.BaseFont).toBe('A@IIZZ+Roboto-Regular'); + }); + }); });