@@ -1081,6 +1081,54 @@ describe('lib/core/event_builder', function() {
1081
1081
assert . deepEqual ( actualParams , expectedParams ) ;
1082
1082
} ) ;
1083
1083
1084
+ it ( 'should include revenue value of 0 in the event object' , function ( ) {
1085
+ var expectedParams = {
1086
+ url : 'https://logx.optimizely.com/v1/events' ,
1087
+ httpVerb : 'POST' ,
1088
+ params : {
1089
+ 'client_version' : packageJSON . version ,
1090
+ 'project_id' : '111001' ,
1091
+ 'visitors' : [ {
1092
+ 'attributes' : [ ] ,
1093
+ 'visitor_id' : 'testUser' ,
1094
+ 'snapshots' : [ {
1095
+ 'events' : [ {
1096
+ 'uuid' : 'a68cf1ad-0393-4e18-af87-efe8f01a7c9c' ,
1097
+ 'tags' : {
1098
+ 'revenue' : 0
1099
+ } ,
1100
+ 'timestamp' : Math . round ( new Date ( ) . getTime ( ) ) ,
1101
+ 'revenue' : 0 ,
1102
+ 'key' : 'testEvent' ,
1103
+ 'entity_id' : '111095'
1104
+ } ]
1105
+ } ]
1106
+ } ] ,
1107
+ 'account_id' : '12001' ,
1108
+ 'client_name' : 'node-sdk' ,
1109
+ 'revision' : '42' ,
1110
+ 'anonymize_ip' : false ,
1111
+ 'enrich_decisions' : true ,
1112
+ } ,
1113
+ } ;
1114
+
1115
+ var eventOptions = {
1116
+ clientEngine : 'node-sdk' ,
1117
+ clientVersion : packageJSON . version ,
1118
+ configObj : configObj ,
1119
+ eventKey : 'testEvent' ,
1120
+ eventTags : {
1121
+ 'revenue' : 0 ,
1122
+ } ,
1123
+ logger : mockLogger ,
1124
+ userId : 'testUser' ,
1125
+ } ;
1126
+
1127
+ var actualParams = eventBuilder . getConversionEvent ( eventOptions ) ;
1128
+
1129
+ assert . deepEqual ( actualParams , expectedParams ) ;
1130
+ } ) ;
1131
+
1084
1132
describe ( 'and the revenue value is invalid' , function ( ) {
1085
1133
it ( 'should not include the revenue value in the event object' , function ( ) {
1086
1134
var expectedParams = {
@@ -1194,6 +1242,54 @@ describe('lib/core/event_builder', function() {
1194
1242
assert . deepEqual ( actualParams , expectedParams ) ;
1195
1243
} ) ;
1196
1244
1245
+ it ( 'should include the falsy event values in the event object' , function ( ) {
1246
+ var expectedParams = {
1247
+ url : 'https://logx.optimizely.com/v1/events' ,
1248
+ httpVerb : 'POST' ,
1249
+ params : {
1250
+ 'client_version' : packageJSON . version ,
1251
+ 'project_id' : '111001' ,
1252
+ 'visitors' : [ {
1253
+ 'attributes' : [ ] ,
1254
+ 'visitor_id' : 'testUser' ,
1255
+ 'snapshots' : [ {
1256
+ 'events' : [ {
1257
+ 'uuid' : 'a68cf1ad-0393-4e18-af87-efe8f01a7c9c' ,
1258
+ 'tags' : {
1259
+ 'value' : '0.0'
1260
+ } ,
1261
+ 'timestamp' : Math . round ( new Date ( ) . getTime ( ) ) ,
1262
+ 'value' : 0.0 ,
1263
+ 'key' : 'testEvent' ,
1264
+ 'entity_id' : '111095'
1265
+ } ]
1266
+ } ]
1267
+ } ] ,
1268
+ 'account_id' : '12001' ,
1269
+ 'client_name' : 'node-sdk' ,
1270
+ 'revision' : '42' ,
1271
+ 'anonymize_ip' : false ,
1272
+ 'enrich_decisions' : true ,
1273
+ } ,
1274
+ } ;
1275
+
1276
+ var eventOptions = {
1277
+ clientEngine : 'node-sdk' ,
1278
+ clientVersion : packageJSON . version ,
1279
+ configObj : configObj ,
1280
+ eventKey : 'testEvent' ,
1281
+ eventTags : {
1282
+ 'value' : '0.0' ,
1283
+ } ,
1284
+ logger : mockLogger ,
1285
+ userId : 'testUser' ,
1286
+ } ;
1287
+
1288
+ var actualParams = eventBuilder . getConversionEvent ( eventOptions ) ;
1289
+
1290
+ assert . deepEqual ( actualParams , expectedParams ) ;
1291
+ } ) ;
1292
+
1197
1293
describe ( 'and the event value is invalid' , function ( ) {
1198
1294
it ( 'should not include the event value in the event object' , function ( ) {
1199
1295
var expectedParams = {
0 commit comments