Files
shaka-player/test/deprecate/version_unit.js
T
Joey Parrish 7e6a0f38ff fix: Correct license headers in misc. files
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
2020-06-09 16:13:56 -07:00

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