mirror of
https://github.com/shaka-project/shaka-player.git
synced 2026-06-26 17:46:26 +03:00
64896d70b0
This reflects changes in Google's policy on JavaScript license headers, which should be smaller to avoid increasing the size of the binary unnecessarily. This also updates the company name from "Google, Inc" to "Google LLC". Change-Id: I3f8b9ed3700b6351f43173d50c94d35c333e82b4
59 lines
1.5 KiB
JavaScript
59 lines
1.5 KiB
JavaScript
/** @license
|
|
* Copyright 2016 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
describe('OfflineUri', () => {
|
|
const OfflineUri = shaka.offline.OfflineUri;
|
|
|
|
it('creates uri from manifest id', () => {
|
|
/** @type {number} */
|
|
const id = 123;
|
|
/** @type {string} */
|
|
const uri = OfflineUri.manifest('mech', 'cell', id).toString();
|
|
|
|
expect(uri).toBe('offline:manifest/mech/cell/123');
|
|
});
|
|
|
|
it('creates uri from segment id', () => {
|
|
/** @type {number} */
|
|
const id = 123;
|
|
/** @type {string} */
|
|
const uri = OfflineUri.segment('mech', 'cell', id).toString();
|
|
|
|
expect(uri).toBe('offline:segment/mech/cell/123');
|
|
});
|
|
|
|
it('creates null from invalid uri', () => {
|
|
/** @type {string} */
|
|
const uri = 'invalid-uri';
|
|
const parsed = OfflineUri.parse(uri);
|
|
|
|
expect(parsed).toBeNull();
|
|
});
|
|
|
|
it('parse manifest uri', () => {
|
|
/** @type {string} */
|
|
const uri = 'offline:manifest/mech/cell/123';
|
|
const parsed = OfflineUri.parse(uri);
|
|
|
|
expect(parsed).toBeTruthy();
|
|
expect(parsed.isManifest()).toBeTruthy();
|
|
expect(parsed.mechanism()).toBe('mech');
|
|
expect(parsed.cell()).toBe('cell');
|
|
expect(parsed.key()).toBe(123);
|
|
});
|
|
|
|
it('parse segment uri', () => {
|
|
/** @type {string} */
|
|
const uri = 'offline:segment/mech/cell/123';
|
|
const parsed = OfflineUri.parse(uri);
|
|
|
|
expect(parsed).toBeTruthy();
|
|
expect(parsed.isSegment()).toBeTruthy();
|
|
expect(parsed.mechanism()).toBe('mech');
|
|
expect(parsed.cell()).toBe('cell');
|
|
expect(parsed.key()).toBe(123);
|
|
});
|
|
});
|