mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Merge from vscode c58aaab8a1cc22a7139b761166a0d4f37d41e998 (#7880)
* Merge from vscode c58aaab8a1cc22a7139b761166a0d4f37d41e998 * fix pipelines * fix strict-null-checks * add missing files
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import * as assert from 'assert';
|
||||
import { resolveWorkbenchCommonProperties } from 'vs/platform/telemetry/browser/workbenchCommonProperties';
|
||||
import { IStorageService, InMemoryStorageService } from 'vs/platform/storage/common/storage';
|
||||
|
||||
suite('Browser Telemetry - common properties', function () {
|
||||
|
||||
const commit: string = (undefined)!;
|
||||
const version: string = (undefined)!;
|
||||
let testStorageService: IStorageService;
|
||||
|
||||
setup(() => {
|
||||
testStorageService = new InMemoryStorageService();
|
||||
});
|
||||
|
||||
test('mixes in additional properties', async function () {
|
||||
const resolveCommonTelemetryProperties = () => {
|
||||
return {
|
||||
'userId': '1'
|
||||
};
|
||||
};
|
||||
|
||||
const props = await resolveWorkbenchCommonProperties(testStorageService, commit, version, 'someMachineId', undefined, resolveCommonTelemetryProperties);
|
||||
|
||||
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('version' in props);
|
||||
assert.ok('common.firstSessionDate' in props, 'firstSessionDate');
|
||||
assert.ok('common.lastSessionDate' in props, 'lastSessionDate');
|
||||
assert.ok('common.isNewSession' in props, 'isNewSession');
|
||||
assert.ok('common.machineId' in props, 'machineId');
|
||||
|
||||
assert.equal(props['userId'], '1');
|
||||
});
|
||||
|
||||
test('mixes in additional dyanmic properties', async function () {
|
||||
let i = 1;
|
||||
const resolveCommonTelemetryProperties = () => {
|
||||
return Object.defineProperties({}, {
|
||||
'userId': {
|
||||
get: () => {
|
||||
return i++;
|
||||
},
|
||||
enumerable: true
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const props = await resolveWorkbenchCommonProperties(testStorageService, commit, version, 'someMachineId', undefined, resolveCommonTelemetryProperties);
|
||||
assert.equal(props['userId'], '1');
|
||||
|
||||
const props2 = await resolveWorkbenchCommonProperties(testStorageService, commit, version, 'someMachineId', undefined, resolveCommonTelemetryProperties);
|
||||
assert.equal(props2['userId'], '2');
|
||||
});
|
||||
});
|
||||
@@ -81,52 +81,4 @@ suite('Telemetry - common properties', function () {
|
||||
value2 = props['common.timesincesessionstart'];
|
||||
assert.ok(value1 !== value2, 'timesincesessionstart');
|
||||
});
|
||||
|
||||
test.skip('mixes in additional properties', async function () { // {{SQL CARBON EDIT}} skip test
|
||||
const resolveCommonTelemetryProperties = () => {
|
||||
return {
|
||||
'userId': '1'
|
||||
};
|
||||
};
|
||||
|
||||
const props = await resolveWorkbenchCommonProperties(testStorageService, commit, version, 'someMachineId', undefined, installSource, undefined, resolveCommonTelemetryProperties);
|
||||
|
||||
assert.ok('commitHash' in props);
|
||||
assert.ok('sessionID' in props);
|
||||
assert.ok('timestamp' in props);
|
||||
assert.ok('common.platform' in props);
|
||||
assert.ok('common.nodePlatform' in props);
|
||||
assert.ok('common.nodeArch' in props);
|
||||
assert.ok('common.timesincesessionstart' in props);
|
||||
assert.ok('common.sequence' in props);
|
||||
assert.ok('common.platformVersion' in props, 'platformVersion');
|
||||
assert.ok('version' in props);
|
||||
assert.ok('common.firstSessionDate' in props, 'firstSessionDate');
|
||||
assert.ok('common.lastSessionDate' in props, 'lastSessionDate');
|
||||
assert.ok('common.isNewSession' in props, 'isNewSession');
|
||||
assert.ok('common.instanceId' in props, 'instanceId');
|
||||
assert.ok('common.machineId' in props, 'machineId');
|
||||
|
||||
assert.equal(props['userId'], '1');
|
||||
});
|
||||
|
||||
test('mixes in additional dyanmic properties', async function () {
|
||||
let i = 1;
|
||||
const resolveCommonTelemetryProperties = () => {
|
||||
return Object.defineProperties({}, {
|
||||
'userId': {
|
||||
get: () => {
|
||||
return i++;
|
||||
},
|
||||
enumerable: true
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const props = await resolveWorkbenchCommonProperties(testStorageService, commit, version, 'someMachineId', undefined, installSource, undefined, resolveCommonTelemetryProperties);
|
||||
assert.equal(props['userId'], '1');
|
||||
|
||||
const props2 = await resolveWorkbenchCommonProperties(testStorageService, commit, version, 'someMachineId', undefined, installSource, undefined, resolveCommonTelemetryProperties);
|
||||
assert.equal(props2['userId'], '2');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user