Add new release line for testing
This commit is contained in:
parent
70dd062753
commit
34cc87e8a8
17 changed files with 199 additions and 43 deletions
|
|
@ -6,8 +6,10 @@ import { useFakeTimers } from 'sinon';
|
|||
import * as semver from 'semver';
|
||||
|
||||
import {
|
||||
generateAlphaVersion,
|
||||
generateTaggedVersion,
|
||||
isAlpha,
|
||||
isAxolotl,
|
||||
isNightly,
|
||||
isBeta,
|
||||
isProduction,
|
||||
isStaging,
|
||||
|
|
@ -57,6 +59,34 @@ describe('version utilities', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('isAxolotl', () => {
|
||||
it('returns false for non-axolotl version strings', () => {
|
||||
assert.isFalse(isAxolotl('1.2.3'));
|
||||
assert.isFalse(isAxolotl('1.2.3-staging.1'));
|
||||
assert.isFalse(isAxolotl('1.2.3-beta'));
|
||||
assert.isFalse(isAxolotl('1.2.3-beta.1'));
|
||||
assert.isFalse(isAxolotl('1.2.3-rc.1'));
|
||||
});
|
||||
|
||||
it('returns true for Axolotl version strings', () => {
|
||||
assert.isTrue(isAxolotl('1.2.3-axolotl'));
|
||||
assert.isTrue(isAxolotl('1.2.3-axolotl.1'));
|
||||
});
|
||||
});
|
||||
|
||||
describe('isNightly', () => {
|
||||
it('returns false for non-nightly version strings', () => {
|
||||
assert.isFalse(isNightly('1.2.3'));
|
||||
assert.isFalse(isNightly('1.2.3-beta.1'));
|
||||
assert.isFalse(isNightly('1.2.3-staging.1'));
|
||||
});
|
||||
|
||||
it('returns true for nightly version strings', () => {
|
||||
assert.isTrue(isNightly('1.2.3-alpha.1'));
|
||||
assert.isTrue(isNightly('1.2.3-axolotl.1'));
|
||||
});
|
||||
});
|
||||
|
||||
describe('isStaging', () => {
|
||||
it('returns false for non-staging version strings', () => {
|
||||
assert.isFalse(isStaging('1.2.3'));
|
||||
|
|
@ -73,7 +103,7 @@ describe('version utilities', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('generateAlphaVersion', () => {
|
||||
describe('generateTaggedVersion', () => {
|
||||
beforeEach(function (this: Mocha.Context) {
|
||||
// This isn't a hook.
|
||||
this.clock = useFakeTimers();
|
||||
|
|
@ -90,7 +120,11 @@ describe('version utilities', () => {
|
|||
const shortSha = '07f0efc45';
|
||||
|
||||
const expected = '5.12.0-alpha.20210723.01-07f0efc45';
|
||||
const actual = generateAlphaVersion({ currentVersion, shortSha });
|
||||
const actual = generateTaggedVersion({
|
||||
release: 'alpha',
|
||||
currentVersion,
|
||||
shortSha,
|
||||
});
|
||||
|
||||
assert.strictEqual(expected, actual);
|
||||
});
|
||||
|
|
@ -100,7 +134,11 @@ describe('version utilities', () => {
|
|||
const shortSha = '07f0efc45';
|
||||
|
||||
this.clock.setSystemTime(new Date('2021-07-23T01:22:55.692Z').getTime());
|
||||
const actual = generateAlphaVersion({ currentVersion, shortSha });
|
||||
const actual = generateTaggedVersion({
|
||||
release: 'alpha',
|
||||
currentVersion,
|
||||
shortSha,
|
||||
});
|
||||
|
||||
assert.isTrue(semver.gt('5.12.0', actual));
|
||||
});
|
||||
|
|
@ -110,7 +148,11 @@ describe('version utilities', () => {
|
|||
const shortSha = '07f0efc45';
|
||||
|
||||
this.clock.setSystemTime(new Date('2021-07-23T01:22:55.692Z').getTime());
|
||||
const actual = generateAlphaVersion({ currentVersion, shortSha });
|
||||
const actual = generateTaggedVersion({
|
||||
release: 'alpha',
|
||||
currentVersion,
|
||||
shortSha,
|
||||
});
|
||||
|
||||
assert.isTrue(semver.gt(currentVersion, actual));
|
||||
});
|
||||
|
|
@ -120,10 +162,18 @@ describe('version utilities', () => {
|
|||
const shortSha = '07f0efc45';
|
||||
|
||||
this.clock.setSystemTime(new Date('2021-07-23T00:22:55.692Z').getTime());
|
||||
const actualEarlier = generateAlphaVersion({ currentVersion, shortSha });
|
||||
const actualEarlier = generateTaggedVersion({
|
||||
release: 'alpha',
|
||||
currentVersion,
|
||||
shortSha,
|
||||
});
|
||||
|
||||
this.clock.setSystemTime(new Date('2021-07-23T01:22:55.692Z').getTime());
|
||||
const actualLater = generateAlphaVersion({ currentVersion, shortSha });
|
||||
const actualLater = generateTaggedVersion({
|
||||
release: 'alpha',
|
||||
currentVersion,
|
||||
shortSha,
|
||||
});
|
||||
|
||||
assert.isTrue(semver.lt(actualEarlier, actualLater));
|
||||
});
|
||||
|
|
@ -133,10 +183,18 @@ describe('version utilities', () => {
|
|||
const shortSha = '07f0efc45';
|
||||
|
||||
this.clock.setSystemTime(new Date('2021-07-22T01:22:55.692Z').getTime());
|
||||
const actualEarlier = generateAlphaVersion({ currentVersion, shortSha });
|
||||
const actualEarlier = generateTaggedVersion({
|
||||
release: 'alpha',
|
||||
currentVersion,
|
||||
shortSha,
|
||||
});
|
||||
|
||||
this.clock.setSystemTime(new Date('2021-07-23T01:22:55.692Z').getTime());
|
||||
const actualLater = generateAlphaVersion({ currentVersion, shortSha });
|
||||
const actualLater = generateTaggedVersion({
|
||||
release: 'alpha',
|
||||
currentVersion,
|
||||
shortSha,
|
||||
});
|
||||
|
||||
assert.isTrue(semver.lt(actualEarlier, actualLater));
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue