Merge pull request #9948 from Snuffleupagus/url-polyfill-unit-tests

Add (basic) unit-tests for the non-global `URL` constructor (PR 9868 follow-up)
This commit is contained in:
Tim van der Meij 2018-08-02 23:32:07 +02:00 committed by GitHub
commit 8a4be24645
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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');
});
});
});