1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 | Object.defineProperty(exports, "__esModule", { value: true });
|
19 | const assert = require("assert");
|
20 | const child_process_1 = require("child_process");
|
21 | const mocha_1 = require("mocha");
|
22 | const moment = require("moment");
|
23 | const index_1 = require("../index");
|
24 | mocha_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 |
|
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 |
|
44 | assert.ok('string' === typeof VERSION.hash);
|
45 | assert.equal(VERSION.hash, HASH);
|
46 | assert.strictEqual(VERSION.hash, HASH);
|
47 | });
|
48 | });
|
49 | });
|
50 |
|
\ | No newline at end of file |