This change fixes tests on Chromecast by loading tests later in the process. Test scripts are now dynamically inserted by boot.js, rather than loaded by Karma. The bootstrapping code then awaits the completion of that before starting the Karma frameworks (Jasmine) to run the tests. This also removes the use of goog.provide/goog.require in tests and test utils. We don't need to load test utils or library sources dynamically in each test, and this gives us more explicit control over script loading and ordering. Closes #4094
58 lines
1.5 KiB
JavaScript
58 lines
1.5 KiB
JavaScript
/*! @license
|
|
* Shaka Player
|
|
* Copyright 2016 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
describe('Version', () => {
|
|
const Version = shaka.deprecate.Version;
|
|
|
|
describe('parse', () => {
|
|
it('can parse full tag', () => {
|
|
const versionString = 'v2.4.3-tag-and-other-words';
|
|
const version = Version.parse(versionString);
|
|
|
|
expect(version.major()).toBe(2);
|
|
expect(version.minor()).toBe(4);
|
|
});
|
|
});
|
|
|
|
describe('toString', () => {
|
|
it('converts version to string', () => {
|
|
const version = new Version(2, 4);
|
|
expect(version.toString()).toBe('v2.4');
|
|
});
|
|
});
|
|
|
|
describe('compareTo', () => {
|
|
it('handles equals', () => {
|
|
const version = new Version(2, 4);
|
|
expect(version.compareTo(version)).toBe(0);
|
|
});
|
|
|
|
it('handles less-than with minor', () => {
|
|
const smaller = new Version(2, 2);
|
|
const larger = new Version(2, 4);
|
|
expect(smaller.compareTo(larger)).toBeLessThan(0);
|
|
});
|
|
|
|
it('handles less-than with major', () => {
|
|
const smaller = new Version(2, 2);
|
|
const larger = new Version(3, 1);
|
|
expect(smaller.compareTo(larger)).toBeLessThan(0);
|
|
});
|
|
|
|
it('handles greater-than with minor', () => {
|
|
const smaller = new Version(2, 2);
|
|
const larger = new Version(2, 4);
|
|
expect(larger.compareTo(smaller)).toBeGreaterThan(0);
|
|
});
|
|
|
|
it('handles greater-than with major', () => {
|
|
const smaller = new Version(2, 2);
|
|
const larger = new Version(3, 1);
|
|
expect(larger.compareTo(smaller)).toBeGreaterThan(0);
|
|
});
|
|
});
|
|
});
|