pdfkit/tests/unit/object.spec.js

24 lines
680 B
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import PDFObject from '../../lib/object';
describe('PDFObject', () => {
describe('convert', () => {
test('string literal', () => {
expect(PDFObject.convert('test')).toEqual('/test');
});
test('string literal with unicode', () => {
expect(PDFObject.convert('αβγδ')).toEqual('/αβγδ');
});
test('String object', () => {
expect(PDFObject.convert(new String('test'))).toEqual('(test)');
});
test('String object with unicode', () => {
const result = PDFObject.convert(new String('αβγδ'));
expect(result.length).toEqual(12);
expect(result).toMatchInlineSnapshot(`"(þÿ±²³´)"`);
});
});
});