@egodigital/egoose
Version:
Helper classes and functions for Node.js 10 or later.
50 lines • 2.24 kB
JavaScript
;
/**
* This file is part of the @egodigital/egoose distribution.
* Copyright (c) e.GO Digital GmbH, Aachen, Germany (https://www.e-go-digital.com/)
*
* @egodigital/egoose is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, version 3.
*
* @egodigital/egoose is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
Object.defineProperty(exports, "__esModule", { value: true });
const assert = require("assert");
const child_process_1 = require("child_process");
const mocha_1 = require("mocha");
const moment = require("moment");
const index_1 = require("../index");
mocha_1.describe('#getAppVersion()', async function () {
mocha_1.describe('sync', function () {
mocha_1.it('should detect app version information', async function () {
const DATE = moment(child_process_1.execSync('git log -n1 --pretty=%cI HEAD')
.toString('utf8')
.trim());
const HASH = child_process_1.execSync('git log --pretty="%H" -n1 HEAD')
.toString('utf8')
.toLowerCase()
.trim();
const VERSION = index_1.getAppVersionSync();
assert.ok('object' === typeof VERSION);
// VERSION.date
assert.ok(moment.isMoment(VERSION.date));
assert.ok(VERSION.date.isValid());
assert.ok(VERSION.date.isUTC());
assert.ok(VERSION.date.isUtc());
assert.equal(VERSION.date.unix(), DATE.unix());
assert.strictEqual(VERSION.date.unix(), DATE.unix());
// VERSION.hash
assert.ok('string' === typeof VERSION.hash);
assert.equal(VERSION.hash, HASH);
assert.strictEqual(VERSION.hash, HASH);
});
});
});
//# sourceMappingURL=getAppVersion.js.map