From 596afaaf7390019f3c3effce573bb85fa82143c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89verton=20Ribeiro?= Date: Mon, 15 Jun 2015 21:30:24 -0300 Subject: [PATCH] [fix_insightkeenio] Adding tracker output spec test. --- spec/utils/tracker_spec.js | 11 +++++++++-- src/config.js | 13 ++++++++----- src/utils/tracker.js | 2 +- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/spec/utils/tracker_spec.js b/spec/utils/tracker_spec.js index 23c19f30..10fe0741 100644 --- a/spec/utils/tracker_spec.js +++ b/spec/utils/tracker_spec.js @@ -1,7 +1,6 @@ import h from 'spec/spec_helper'; import { default as tracker } from 'azk/utils/tracker'; - -// azk nvm grunt --grep='Azk Tracker' +import { meta as azkMeta } from 'azk'; describe("Azk Tracker", function() { this.timeout(2000); @@ -22,4 +21,12 @@ describe("Azk Tracker", function() { var expectedSessionId = tracker.loadAgentSessionId(); h.expect(sessionId).to.equal(expectedSessionId); }); + + it("should override insight get/set for optout", function() { + return azkMeta.cleanAsync().then(() => { + tracker.insight.optOut = true; + var metaOptout = azkMeta.get(tracker.insight_opts.opt_out_key); + h.expect(metaOptout).to.equal(false); + }); + }); }); diff --git a/src/config.js b/src/config.js index f244fa8a..3864a47b 100644 --- a/src/config.js +++ b/src/config.js @@ -80,6 +80,7 @@ var options = mergeConfig({ }, // jscs:disable maximumLineLength tracker: { + permission_key: 'tracker_permission', disable: envs('AZK_DISABLE_TRACKER', false), projectId: envs('AZK_KEEN_PROJECT_ID', '552818c790e4bd7f7bd8baba'), writeKey: envs('AZK_KEEN_WRITE_KEY', 'e2c70b3dd3ed3003a09a1bc7d8622ad9220fe33069d81164f0fafa13baf11458e48736f6cbcc995a8346183b290597504feb4bef06f71350f4859df5eb271a1d845f7cff5c9dfddf2f03de1e39760c6e51a06fb9e347c2e1fb98d3c6d370e6916e5db8810ddd9c0d5d83540386ccfe2e'), @@ -136,11 +137,8 @@ var options = mergeConfig({ }, test: { paths: { - // jscs:disable maximumLineLength - log : path.join(paths.logs, 'azk_test.log'), - projectId: envs('AZK_KEEN_PROJECT_ID', '5526968d672e6c5a0d0ebec6'), - writeKey: envs('AZK_KEEN_WRITE_KEY', '5dbce13e376070e36eec0c7dd1e7f42e49f39b4db041f208054617863832309c14a797409e12d976630c3a4b479004f26b362506e82a46dd54df0c977a7378da280c05ae733c97abb445f58abb56ae15f561ac9ad774cea12c3ad8628d896c39f6e702f6b035541fc1a562997cb05768'), - // jscs:enabled maximumLineLength + log : path.join(paths.logs, 'azk_test.log'), + azk_meta: path.join(data_path, azk_dir, "shared", "test-Azkfile.js"), }, docker: { namespace : 'azk.test', @@ -150,6 +148,11 @@ var options = mergeConfig({ }, tracker: { disable: true, + // jscs:disable maximumLineLength + permission_key: 'tracker_permission_test', + projectId : envs('AZK_KEEN_PROJECT_ID', '5526968d672e6c5a0d0ebec6'), + writeKey : envs('AZK_KEEN_WRITE_KEY', '5dbce13e376070e36eec0c7dd1e7f42e49f39b4db041f208054617863832309c14a797409e12d976630c3a4b479004f26b362506e82a46dd54df0c977a7378da280c05ae733c97abb445f58abb56ae15f561ac9ad774cea12c3ad8628d896c39f6e702f6b035541fc1a562997cb05768'), + // jscs:enabled maximumLineLength }, logs_level: { console: (envs('AZK_DEBUG') ? 'debug' : 'warn'), diff --git a/src/utils/tracker.js b/src/utils/tracker.js index 6d387f5f..973e1af3 100644 --- a/src/utils/tracker.js +++ b/src/utils/tracker.js @@ -202,7 +202,7 @@ export class Tracker { // Default tracker var default_tracker = new Tracker({}, { - permission: 'tracker_permission', + permission: config('tracker:permission_key'), user_id : 'tracker_user_id', agent_id : 'agent_session_id', });