@@ -19,6 +19,7 @@ describe('MongoshLoggingAndTelemetry', function () {
1919
2020 const userId = '53defe995fa47e6c13102d9d' ;
2121 const logId = '5fb3c20ee1507e894e5340f3' ;
22+ const deviceId = 'test-device' ;
2223
2324 let logger : MongoLogWriter ;
2425
@@ -39,7 +40,6 @@ describe('MongoshLoggingAndTelemetry', function () {
3940 const testLoggingArguments : Omit < MongoshLoggingAndTelemetryArguments , 'bus' > =
4041 {
4142 analytics,
42- deviceId : 'test-device' ,
4343 userTraits : {
4444 platform : process . platform ,
4545 arch : process . arch ,
@@ -54,6 +54,7 @@ describe('MongoshLoggingAndTelemetry', function () {
5454
5555 loggingAndTelemetry = setupLoggingAndTelemetry ( {
5656 ...testLoggingArguments ,
57+ deviceId,
5758 bus,
5859 } ) ;
5960
@@ -117,8 +118,8 @@ describe('MongoshLoggingAndTelemetry', function () {
117118 'identify' ,
118119 {
119120 anonymousId : userId ,
120- deviceId : 'test-device' ,
121121 traits : {
122+ device_id : deviceId ,
122123 arch : process . arch ,
123124 platform : process . platform ,
124125 session_id : logId ,
@@ -129,7 +130,6 @@ describe('MongoshLoggingAndTelemetry', function () {
129130 'track' ,
130131 {
131132 anonymousId : userId ,
132- deviceId : 'test-device' ,
133133 event : 'New Connection' ,
134134 properties : {
135135 mongosh_version : '1.0.0' ,
@@ -178,8 +178,8 @@ describe('MongoshLoggingAndTelemetry', function () {
178178 'identify' ,
179179 {
180180 anonymousId : userId ,
181- deviceId : 'test-device' ,
182181 traits : {
182+ device_id : deviceId ,
183183 arch : process . arch ,
184184 platform : process . platform ,
185185 session_id : logId ,
@@ -190,7 +190,6 @@ describe('MongoshLoggingAndTelemetry', function () {
190190 'track' ,
191191 {
192192 anonymousId : userId ,
193- deviceId : 'test-device' ,
194193 event : 'New Connection' ,
195194 properties : {
196195 mongosh_version : '1.0.0' ,
@@ -235,9 +234,9 @@ describe('MongoshLoggingAndTelemetry', function () {
235234 [
236235 'identify' ,
237236 {
238- deviceId : 'unknown' ,
239237 anonymousId : userId ,
240238 traits : {
239+ device_id : 'unknown' ,
241240 platform : process . platform ,
242241 arch : process . arch ,
243242 session_id : logId ,
@@ -272,9 +271,9 @@ describe('MongoshLoggingAndTelemetry', function () {
272271 [
273272 'identify' ,
274273 {
275- deviceId,
276274 anonymousId : userId ,
277275 traits : {
276+ device_id : deviceId ,
278277 platform : process . platform ,
279278 arch : process . arch ,
280279 session_id : logId ,
@@ -299,7 +298,7 @@ describe('MongoshLoggingAndTelemetry', function () {
299298 ...testLoggingArguments ,
300299 bus,
301300 deviceId : undefined ,
302- } ) ;
301+ } ) as LoggingAndTelemetry ;
303302
304303 loggingAndTelemetry . attachLogger ( logger ) ;
305304
@@ -310,13 +309,13 @@ describe('MongoshLoggingAndTelemetry', function () {
310309 expect ( analyticsOutput ) . to . have . lengthOf ( 0 ) ;
311310
312311 resolveTelemetry ( '1234' ) ;
313- await ( loggingAndTelemetry as LoggingAndTelemetry ) . setupTelemetryPromise ;
312+ await loggingAndTelemetry . setupTelemetryPromise ;
314313
315314 expect ( logOutput ) . to . have . lengthOf ( 1 ) ;
316315 expect ( analyticsOutput ) . to . have . lengthOf ( 1 ) ;
317316
318317 // Hash created from machine ID 1234
319- expect ( analyticsOutput [ 0 ] [ 1 ] . deviceId ) . equals (
318+ expect ( loggingAndTelemetry [ ' deviceId' ] ) . equals (
320319 '8c9f929608f0ef13bfd5a290e0233f283e2cc25ffefc2ad8d9ef0650eb224a52'
321320 ) ;
322321 } ) ;
@@ -719,8 +718,8 @@ describe('MongoshLoggingAndTelemetry', function () {
719718 'identify' ,
720719 {
721720 anonymousId : userId ,
722- deviceId : 'test-device' ,
723721 traits : {
722+ device_id : deviceId ,
724723 platform : process . platform ,
725724 arch : process . arch ,
726725 session_id : logId ,
@@ -731,8 +730,8 @@ describe('MongoshLoggingAndTelemetry', function () {
731730 'identify' ,
732731 {
733732 anonymousId : userId ,
734- deviceId : 'test-device' ,
735733 traits : {
734+ device_id : deviceId ,
736735 platform : process . platform ,
737736 arch : process . arch ,
738737 session_id : logId ,
@@ -743,7 +742,6 @@ describe('MongoshLoggingAndTelemetry', function () {
743742 'track' ,
744743 {
745744 anonymousId : userId ,
746- deviceId : 'test-device' ,
747745 event : 'Startup Time' ,
748746 properties : {
749747 is_interactive : true ,
@@ -759,7 +757,6 @@ describe('MongoshLoggingAndTelemetry', function () {
759757 'track' ,
760758 {
761759 anonymousId : '53defe995fa47e6c13102d9d' ,
762- deviceId : 'test-device' ,
763760 event : 'Error' ,
764761 properties : {
765762 mongosh_version : '1.0.0' ,
@@ -775,7 +772,6 @@ describe('MongoshLoggingAndTelemetry', function () {
775772 'track' ,
776773 {
777774 anonymousId : '53defe995fa47e6c13102d9d' ,
778- deviceId : 'test-device' ,
779775 event : 'Error' ,
780776 properties : {
781777 mongosh_version : '1.0.0' ,
@@ -791,7 +787,6 @@ describe('MongoshLoggingAndTelemetry', function () {
791787 'track' ,
792788 {
793789 anonymousId : '53defe995fa47e6c13102d9d' ,
794- deviceId : 'test-device' ,
795790 event : 'Use' ,
796791 properties : {
797792 mongosh_version : '1.0.0' ,
@@ -803,7 +798,6 @@ describe('MongoshLoggingAndTelemetry', function () {
803798 'track' ,
804799 {
805800 anonymousId : '53defe995fa47e6c13102d9d' ,
806- deviceId : 'test-device' ,
807801 event : 'Show' ,
808802 properties : {
809803 mongosh_version : '1.0.0' ,
@@ -823,7 +817,6 @@ describe('MongoshLoggingAndTelemetry', function () {
823817 shell : true ,
824818 } ,
825819 anonymousId : '53defe995fa47e6c13102d9d' ,
826- deviceId : 'test-device' ,
827820 } ,
828821 ] ,
829822 [
@@ -836,7 +829,6 @@ describe('MongoshLoggingAndTelemetry', function () {
836829 nested : false ,
837830 } ,
838831 anonymousId : '53defe995fa47e6c13102d9d' ,
839- deviceId : 'test-device' ,
840832 } ,
841833 ] ,
842834 [
@@ -848,7 +840,6 @@ describe('MongoshLoggingAndTelemetry', function () {
848840 session_id : logId ,
849841 } ,
850842 anonymousId : '53defe995fa47e6c13102d9d' ,
851- deviceId : 'test-device' ,
852843 } ,
853844 ] ,
854845 [
@@ -860,7 +851,6 @@ describe('MongoshLoggingAndTelemetry', function () {
860851 session_id : logId ,
861852 } ,
862853 anonymousId : '53defe995fa47e6c13102d9d' ,
863- deviceId : 'test-device' ,
864854 } ,
865855 ] ,
866856 [
@@ -873,14 +863,12 @@ describe('MongoshLoggingAndTelemetry', function () {
873863 shell : true ,
874864 } ,
875865 anonymousId : '53defe995fa47e6c13102d9d' ,
876- deviceId : 'test-device' ,
877866 } ,
878867 ] ,
879868 [
880869 'track' ,
881870 {
882871 anonymousId : '53defe995fa47e6c13102d9d' ,
883- deviceId : 'test-device' ,
884872 event : 'Snippet Install' ,
885873 properties : {
886874 mongosh_version : '1.0.0' ,
@@ -976,7 +964,6 @@ describe('MongoshLoggingAndTelemetry', function () {
976964 'track' ,
977965 {
978966 anonymousId : '53defe995fa47e6c13102d9d' ,
979- deviceId : 'test-device' ,
980967 event : 'Deprecated Method' ,
981968 properties : {
982969 mongosh_version : '1.0.0' ,
@@ -990,7 +977,6 @@ describe('MongoshLoggingAndTelemetry', function () {
990977 'track' ,
991978 {
992979 anonymousId : '53defe995fa47e6c13102d9d' ,
993- deviceId : 'test-device' ,
994980 event : 'Deprecated Method' ,
995981 properties : {
996982 mongosh_version : '1.0.0' ,
@@ -1004,7 +990,6 @@ describe('MongoshLoggingAndTelemetry', function () {
1004990 'track' ,
1005991 {
1006992 anonymousId : '53defe995fa47e6c13102d9d' ,
1007- deviceId : 'test-device' ,
1008993 event : 'Deprecated Method' ,
1009994 properties : {
1010995 mongosh_version : '1.0.0' ,
@@ -1018,7 +1003,6 @@ describe('MongoshLoggingAndTelemetry', function () {
10181003 'track' ,
10191004 {
10201005 anonymousId : '53defe995fa47e6c13102d9d' ,
1021- deviceId : 'test-device' ,
10221006 event : 'API Call' ,
10231007 properties : {
10241008 mongosh_version : '1.0.0' ,
@@ -1033,7 +1017,6 @@ describe('MongoshLoggingAndTelemetry', function () {
10331017 'track' ,
10341018 {
10351019 anonymousId : '53defe995fa47e6c13102d9d' ,
1036- deviceId : 'test-device' ,
10371020 event : 'API Call' ,
10381021 properties : {
10391022 mongosh_version : '1.0.0' ,
@@ -1188,7 +1171,6 @@ describe('MongoshLoggingAndTelemetry', function () {
11881171 'track' ,
11891172 {
11901173 anonymousId : undefined ,
1191- deviceId : 'test-device' ,
11921174 event : 'New Connection' ,
11931175 properties : {
11941176 mongosh_version : '1.0.0' ,
0 commit comments