From f8388710e6b14321392948cbcb0bddddf6fd0440 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Thu, 2 Aug 2018 10:32:06 +0200 Subject: [PATCH] Add (basic) unit-tests for the non-global `URL` constructor (PR 9868 follow-up) This should really have been included in PR 9868, since it will help ensure that the `URL` constructor is correctly imported/exported by `src/shared/util.js`. --- test/unit/util_spec.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/test/unit/util_spec.js b/test/unit/util_spec.js index 47b8a037f..87059f89e 100644 --- a/test/unit/util_spec.js +++ b/test/unit/util_spec.js @@ -16,7 +16,7 @@ import { bytesToString, getInheritableProperty, isArrayBuffer, isBool, isEmptyObj, isNum, isSpace, isString, log2, ReadableStream, removeNullCharacters, - stringToBytes, stringToPDFString + stringToBytes, stringToPDFString, URL } from '../../src/shared/util'; import { Dict, Ref } from '../../src/core/primitives'; import { XRefMock } from './test_utils'; @@ -311,4 +311,16 @@ describe('util', function() { expect(typeof readable.getReader).toEqual('function'); }); }); + + describe('URL', function() { + it('should return an Object', function() { + const url = new URL('https://example.com'); + expect(typeof url).toEqual('object'); + }); + + it('should have property `href`', function() { + const url = new URL('https://example.com'); + expect(typeof url.href).toEqual('string'); + }); + }); });