mirror of
https://github.com/shaka-project/shaka-player.git
synced 2026-06-17 16:26:39 +03:00
7e6a0f38ff
This corrects/normalizes license headers in misc. files, such as config files, docs, build tools, tests, and externs. This does not affect the compiled output, and is only done for consistency. Issue #2638 Change-Id: I9d8da2de55243b08d7df2b743aac73c6f15e858a
60 lines
1.5 KiB
JavaScript
60 lines
1.5 KiB
JavaScript
/*! @license
|
|
* Shaka Player
|
|
* 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);
|
|
});
|
|
});
|