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:
Kevin Zhao 2016-12-15 16:45:32 +08:00 коммит произвёл GitHub
Родитель 612e625745
Коммит a8a65735d0
3 изменённых файлов: 5 добавлений и 4 удалений

Просмотреть файл

@ -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);