зеркало из https://github.com/Azure/az-iot-bi.git
enable user consent on BI data collecting (#36)
* enable user consent on BI data collecting * clean up old comments * fix tests
This commit is contained in:
Родитель
612e625745
Коммит
a8a65735d0
|
@ -128,8 +128,7 @@ function isStarted () {
|
|||
module.exports.isStarted = isStarted;
|
||||
|
||||
module.exports.start = function (instrumentationKey) {
|
||||
// Skip asking user's approval for data collection for preview release
|
||||
if (!settings.isBIEnabled(true)) {
|
||||
if (!settings.isBIEnabled()) {
|
||||
return false;
|
||||
}
|
||||
appInsight.setup(instrumentationKey)
|
||||
|
|
|
@ -77,11 +77,11 @@ biSetting.isBIEnabled = function (skipCheck) {
|
|||
var promptText = '\nMicrosoft would like to collect data about how users use Azure IoT samples and some problems they encounter. ' +
|
||||
'Microsoft uses this information to improve our tooling experience. Participation is voluntary and when you choose to participate ' +
|
||||
'your device automatically sends information to Microsoft about how you use Azure IoT samples. ' +
|
||||
'\n\nSelect y to enable data collection :(y/n, default is n) ';
|
||||
'\n\nSelect y to enable data collection :(y/n, default is y) ';
|
||||
|
||||
var options = {
|
||||
limit: ['y', 'n'],
|
||||
defaultInput: 'n'
|
||||
defaultInput: 'y'
|
||||
};
|
||||
|
||||
var choice = readlineSync.question(promptText, options);
|
||||
|
|
|
@ -39,6 +39,7 @@ describe('lib/appInsightsWrapper', function () {
|
|||
|
||||
describe('#trackEvent(eventName, properties)', function () {
|
||||
it('should send event to Application Insights.', sinon.test(function () {
|
||||
this.stub(settings, 'isBIEnabled', () => true);
|
||||
this.stub(os, 'arch', () => 'fakeArch');
|
||||
this.stub(os, 'type', () => 'fakeType');
|
||||
this.stub(os, 'platform', () => 'fakePlatform');
|
||||
|
@ -82,6 +83,7 @@ describe('lib/appInsightsWrapper', function () {
|
|||
|
||||
describe('#sendPendingData()', function () {
|
||||
it('should send pending events to Application Insights.', sinon.test(function () {
|
||||
this.stub(settings, 'isBIEnabled', () => true);
|
||||
wrapper.start(config.instrumentationKey);
|
||||
var sendPendingDataStub = this.stub(appInsight.client, 'sendPendingData', () => null);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче