UNPKG

2.24 kBJavaScriptView Raw
1"use strict";
2/**
3 * This file is part of the @egodigital/egoose distribution.
4 * Copyright (c) e.GO Digital GmbH, Aachen, Germany (https://www.e-go-digital.com/)
5 *
6 * @egodigital/egoose is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as
8 * published by the Free Software Foundation, version 3.
9 *
10 * @egodigital/egoose is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18Object.defineProperty(exports, "__esModule", { value: true });
19const assert = require("assert");
20const child_process_1 = require("child_process");
21const mocha_1 = require("mocha");
22const moment = require("moment");
23const index_1 = require("../index");
24mocha_1.describe('#getAppVersion()', async function () {
25 mocha_1.describe('sync', function () {
26 mocha_1.it('should detect app version information', async function () {
27 const DATE = moment(child_process_1.execSync('git log -n1 --pretty=%cI HEAD')
28 .toString('utf8')
29 .trim());
30 const HASH = child_process_1.execSync('git log --pretty="%H" -n1 HEAD')
31 .toString('utf8')
32 .toLowerCase()
33 .trim();
34 const VERSION = index_1.getAppVersionSync();
35 assert.ok('object' === typeof VERSION);
36 // VERSION.date
37 assert.ok(moment.isMoment(VERSION.date));
38 assert.ok(VERSION.date.isValid());
39 assert.ok(VERSION.date.isUTC());
40 assert.ok(VERSION.date.isUtc());
41 assert.equal(VERSION.date.unix(), DATE.unix());
42 assert.strictEqual(VERSION.date.unix(), DATE.unix());
43 // VERSION.hash
44 assert.ok('string' === typeof VERSION.hash);
45 assert.equal(VERSION.hash, HASH);
46 assert.strictEqual(VERSION.hash, HASH);
47 });
48 });
49});
50//# sourceMappingURL=getAppVersion.js.map
\No newline at end of file