11import { AnalyticsServerEvent } from "@jitsu/protocols/analytics" ;
22import type { Event as JitsuLegacyEvent } from "@jitsu/sdk-js" ;
3- import { FullContext , UserAgent } from "@jitsu/protocols/functions" ;
4- import { fromJitsuClassic , removeUndefined , TableNameParameter , toJitsuClassic , toSnakeCase } from "../src" ;
3+ import { FullContext } from "@jitsu/protocols/functions" ;
4+ import { fromJitsuClassic , toJitsuClassic } from "../src" ;
55import { classicEvents } from "./data/classic-events" ;
66
77const identify : AnalyticsServerEvent = {
@@ -264,14 +264,22 @@ const legacyPageExpectedWarehouse = {
264264} ;
265265
266266test ( "legacy event s3" , ( ) => {
267- const identifyLegacyResult = toJitsuClassic ( identify , {
268- props : { keepOriginalNames : true } ,
269- destination : { type : "s3" } ,
270- } as unknown as FullContext ) ;
271- const pageLegacyResult = toJitsuClassic ( page , {
272- props : { keepOriginalNames : true } ,
273- destination : { type : "s3" } ,
274- } as unknown as FullContext ) ;
267+ const identifyLegacyResult = toJitsuClassic (
268+ identify ,
269+ {
270+ props : { keepOriginalNames : true } ,
271+ destination : { type : "s3" } ,
272+ } as unknown as FullContext ,
273+ true
274+ ) ;
275+ const pageLegacyResult = toJitsuClassic (
276+ page ,
277+ {
278+ props : { keepOriginalNames : true } ,
279+ destination : { type : "s3" } ,
280+ } as unknown as FullContext ,
281+ true
282+ ) ;
275283 console . log ( JSON . stringify ( identifyLegacyResult , null , 2 ) ) ;
276284 expect ( identifyLegacyResult ) . toStrictEqual ( legacyIdentifyExpectedS3 ) ;
277285
@@ -280,14 +288,22 @@ test("legacy event s3", () => {
280288} ) ;
281289
282290test ( "legacy event warehouse" , ( ) => {
283- const identifyLegacyResult = toJitsuClassic ( identify , {
284- props : { keepOriginalNames : true } ,
285- destination : { type : "postgres" } ,
286- } as unknown as FullContext ) ;
287- const pageLegacyResult = toJitsuClassic ( page , {
288- props : { keepOriginalNames : true } ,
289- destination : { type : "postgres" } ,
290- } as unknown as FullContext ) ;
291+ const identifyLegacyResult = toJitsuClassic (
292+ identify ,
293+ {
294+ props : { keepOriginalNames : true } ,
295+ destination : { type : "postgres" } ,
296+ } as unknown as FullContext ,
297+ true
298+ ) ;
299+ const pageLegacyResult = toJitsuClassic (
300+ page ,
301+ {
302+ props : { keepOriginalNames : true } ,
303+ destination : { type : "postgres" } ,
304+ } as unknown as FullContext ,
305+ true
306+ ) ;
291307 console . log ( JSON . stringify ( identifyLegacyResult , null , 2 ) ) ;
292308 expect ( identifyLegacyResult ) . toStrictEqual ( legacyIdentifyExpectedWarehouse ) ;
293309
@@ -307,7 +323,8 @@ test("classic events mapping", () => {
307323 const restored = fromJitsuClassic ( event ) ;
308324 const mapped = toJitsuClassic (
309325 restored as AnalyticsServerEvent ,
310- { props : { keepOriginalNames : true } , destination : { type : "s3" } } as unknown as FullContext
326+ { props : { keepOriginalNames : true } , destination : { type : "s3" } } as unknown as FullContext ,
327+ true
311328 ) ;
312329 delete mapped . anon_ip ;
313330 expect ( mapped ) . toStrictEqual ( event ) ;
0 commit comments