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`.
This commit is contained in:
Jonas Jenwald 2018-08-02 10:32:06 +02:00
parent 716acf63d4
commit f8388710e6

View File

@ -16,7 +16,7 @@
import { import {
bytesToString, getInheritableProperty, isArrayBuffer, isBool, isEmptyObj, bytesToString, getInheritableProperty, isArrayBuffer, isBool, isEmptyObj,
isNum, isSpace, isString, log2, ReadableStream, removeNullCharacters, isNum, isSpace, isString, log2, ReadableStream, removeNullCharacters,
stringToBytes, stringToPDFString stringToBytes, stringToPDFString, URL
} from '../../src/shared/util'; } from '../../src/shared/util';
import { Dict, Ref } from '../../src/core/primitives'; import { Dict, Ref } from '../../src/core/primitives';
import { XRefMock } from './test_utils'; import { XRefMock } from './test_utils';
@ -311,4 +311,16 @@ describe('util', function() {
expect(typeof readable.getReader).toEqual('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');
});
});
}); });