@@ -1097,6 +1097,54 @@ describe('lib/core/event_builder', function() {
10971097 assert . deepEqual ( actualParams , expectedParams ) ;
10981098 } ) ;
10991099
1100+ it ( 'should include revenue value of 0 in the event object' , function ( ) {
1101+ var expectedParams = {
1102+ url : 'https://logx.optimizely.com/v1/events' ,
1103+ httpVerb : 'POST' ,
1104+ params : {
1105+ 'client_version' : packageJSON . version ,
1106+ 'project_id' : '111001' ,
1107+ 'visitors' : [ {
1108+ 'attributes' : [ ] ,
1109+ 'visitor_id' : 'testUser' ,
1110+ 'snapshots' : [ {
1111+ 'events' : [ {
1112+ 'uuid' : 'a68cf1ad-0393-4e18-af87-efe8f01a7c9c' ,
1113+ 'tags' : {
1114+ 'revenue' : 0
1115+ } ,
1116+ 'timestamp' : Math . round ( new Date ( ) . getTime ( ) ) ,
1117+ 'revenue' : 0 ,
1118+ 'key' : 'testEvent' ,
1119+ 'entity_id' : '111095'
1120+ } ]
1121+ } ]
1122+ } ] ,
1123+ 'account_id' : '12001' ,
1124+ 'client_name' : 'node-sdk' ,
1125+ 'revision' : '42' ,
1126+ 'anonymize_ip' : false ,
1127+ 'enrich_decisions' : true ,
1128+ } ,
1129+ } ;
1130+
1131+ var eventOptions = {
1132+ clientEngine : 'node-sdk' ,
1133+ clientVersion : packageJSON . version ,
1134+ configObj : configObj ,
1135+ eventKey : 'testEvent' ,
1136+ eventTags : {
1137+ 'revenue' : 0 ,
1138+ } ,
1139+ logger : mockLogger ,
1140+ userId : 'testUser' ,
1141+ } ;
1142+
1143+ var actualParams = eventBuilder . getConversionEvent ( eventOptions ) ;
1144+
1145+ assert . deepEqual ( actualParams , expectedParams ) ;
1146+ } ) ;
1147+
11001148 describe ( 'and the revenue value is invalid' , function ( ) {
11011149 it ( 'should not include the revenue value in the event object' , function ( ) {
11021150 var expectedParams = {
@@ -1200,6 +1248,54 @@ describe('lib/core/event_builder', function() {
12001248 assert . deepEqual ( actualParams , expectedParams ) ;
12011249 } ) ;
12021250
1251+ it ( 'should include the falsy event values in the event object' , function ( ) {
1252+ var expectedParams = {
1253+ url : 'https://logx.optimizely.com/v1/events' ,
1254+ httpVerb : 'POST' ,
1255+ params : {
1256+ 'client_version' : packageJSON . version ,
1257+ 'project_id' : '111001' ,
1258+ 'visitors' : [ {
1259+ 'attributes' : [ ] ,
1260+ 'visitor_id' : 'testUser' ,
1261+ 'snapshots' : [ {
1262+ 'events' : [ {
1263+ 'uuid' : 'a68cf1ad-0393-4e18-af87-efe8f01a7c9c' ,
1264+ 'tags' : {
1265+ 'value' : '0.0'
1266+ } ,
1267+ 'timestamp' : Math . round ( new Date ( ) . getTime ( ) ) ,
1268+ 'value' : 0.0 ,
1269+ 'key' : 'testEvent' ,
1270+ 'entity_id' : '111095'
1271+ } ]
1272+ } ]
1273+ } ] ,
1274+ 'account_id' : '12001' ,
1275+ 'client_name' : 'node-sdk' ,
1276+ 'revision' : '42' ,
1277+ 'anonymize_ip' : false ,
1278+ 'enrich_decisions' : true ,
1279+ } ,
1280+ } ;
1281+
1282+ var eventOptions = {
1283+ clientEngine : 'node-sdk' ,
1284+ clientVersion : packageJSON . version ,
1285+ configObj : configObj ,
1286+ eventKey : 'testEvent' ,
1287+ eventTags : {
1288+ 'value' : '0.0' ,
1289+ } ,
1290+ logger : mockLogger ,
1291+ userId : 'testUser' ,
1292+ } ;
1293+
1294+ var actualParams = eventBuilder . getConversionEvent ( eventOptions ) ;
1295+
1296+ assert . deepEqual ( actualParams , expectedParams ) ;
1297+ } ) ;
1298+
12031299 describe ( 'and the event value is invalid' , function ( ) {
12041300 it ( 'should not include the event value in the event object' , function ( ) {
12051301 var expectedParams = {
0 commit comments