<commit_before>/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/
'use strict';

import * as assert from 'assert';
import {TPromise} from 'vs/base/common/winjs.base';
import {resolveWorkbenchCommonProperties} from 'vs/platform/telemetry/node/workbenchCommonProperties';
import {TestStorageService, TestContextService} from 'vs/test/utils/servicesTestUtils';

suite('Telemetry - common properties', function () {

	const contextService = new TestContextService();
	const commit = contextService.getConfiguration().env.commitHash;
	const version = contextService.getConfiguration().env.version;

	test('default', function () {

		return resolveWorkbenchCommonProperties(new TestStorageService(), commit, version).then(props => {

			assert.ok('commitHash' in props);
			assert.ok('sessionID' in props);
			assert.ok('timestamp' in props);
			assert.ok('common.platform' in props);
			assert.ok('common.timesincesessionstart' in props);
			assert.ok('common.sequence' in props);

			// assert.ok('common.version.shell' in first.data); // only when running on electron
			// assert.ok('common.version.renderer' in first.data);
			assert.ok('common.osVersion' in props, 'osVersion');
			assert.ok('version' in props);<commit_msg>remove one no-op use of context service in tests<commit_after>/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/
'use strict';

import * as assert from 'assert';
import {TPromise} from 'vs/base/common/winjs.base';
import {resolveWorkbenchCommonProperties} from 'vs/platform/telemetry/node/workbenchCommonProperties';
import {TestStorageService} from 'vs/test/utils/servicesTestUtils';

suite('Telemetry - common properties', function () {

	const commit = void 0;
	const version = void 0;

	test('default', function () {

		return resolveWorkbenchCommonProperties(new TestStorageService(), commit, version).then(props => {

			assert.ok('commitHash' in props);
			assert.ok('sessionID' in props);
			assert.ok('timestamp' in props);
			assert.ok('common.platform' in props);
			assert.ok('common.timesincesessionstart' in props);
			assert.ok('common.sequence' in props);

			// assert.ok('common.version.shell' in first.data); // only when running on electron
			// assert.ok('common.version.renderer' in first.data);
			assert.ok('common.osVersion' in props, 'osVersion');
			assert.ok('version' in props);
{'fraction_non_alphanumeric': 0.23994546693933197, 'fraction_numerical': 0.0006816632583503749, 'mean_word_length': 2.6733416770963703, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5010501', 'n_tokens_mistral': 769, 'n_tokens_neox': 718, 'n_words': 202}