@@ -26,19 +26,19 @@ beforeEach(() => {
2626describe ( 'createConsentManager' , ( ) => {
2727 it ( 'defaults to none when no initial level provided' , ( ) => {
2828 const queue = createMockQueue ( ) ;
29- const manager = createConsentManager ( queue , 'pk_test' , 'anon-1' , 'dev' ) ;
29+ const manager = createConsentManager ( queue , 'pk_test' , 'anon-1' , 'dev' , 'pixel' ) ;
3030 expect ( manager . level ) . toBe ( 'none' ) ;
3131 } ) ;
3232
3333 it ( 'uses the initial level when provided' , ( ) => {
3434 const queue = createMockQueue ( ) ;
35- const manager = createConsentManager ( queue , 'pk_test' , 'anon-1' , 'dev' , 'anonymous' ) ;
35+ const manager = createConsentManager ( queue , 'pk_test' , 'anon-1' , 'dev' , 'pixel' , ' anonymous') ;
3636 expect ( manager . level ) . toBe ( 'anonymous' ) ;
3737 } ) ;
3838
3939 it ( 'upgrades consent without modifying queue' , ( ) => {
4040 const queue = createMockQueue ( ) ;
41- const manager = createConsentManager ( queue , 'pk_test' , 'anon-1' , 'dev' , 'none' ) ;
41+ const manager = createConsentManager ( queue , 'pk_test' , 'anon-1' , 'dev' , 'pixel' , ' none') ;
4242
4343 manager . setLevel ( 'anonymous' ) ;
4444 expect ( manager . level ) . toBe ( 'anonymous' ) ;
@@ -48,7 +48,7 @@ describe('createConsentManager', () => {
4848
4949 it ( 'purges queue on downgrade to none' , ( ) => {
5050 const queue = createMockQueue ( ) ;
51- const manager = createConsentManager ( queue , 'pk_test' , 'anon-1' , 'dev' , 'full' ) ;
51+ const manager = createConsentManager ( queue , 'pk_test' , 'anon-1' , 'dev' , 'pixel' , ' full') ;
5252
5353 manager . setLevel ( 'none' ) ;
5454 expect ( manager . level ) . toBe ( 'none' ) ;
@@ -61,7 +61,7 @@ describe('createConsentManager', () => {
6161
6262 it ( 'strips userId on downgrade from full to anonymous' , ( ) => {
6363 const queue = createMockQueue ( ) ;
64- const manager = createConsentManager ( queue , 'pk_test' , 'anon-1' , 'dev' , 'full' ) ;
64+ const manager = createConsentManager ( queue , 'pk_test' , 'anon-1' , 'dev' , 'pixel' , ' full') ;
6565
6666 manager . setLevel ( 'anonymous' ) ;
6767 expect ( manager . level ) . toBe ( 'anonymous' ) ;
@@ -77,7 +77,7 @@ describe('createConsentManager', () => {
7777
7878 it ( 'fires PUT to consent endpoint on level change' , ( ) => {
7979 const queue = createMockQueue ( ) ;
80- const manager = createConsentManager ( queue , 'pk_test' , 'anon-1' , 'dev' , 'none' ) ;
80+ const manager = createConsentManager ( queue , 'pk_test' , 'anon-1' , 'dev' , 'pixel' , ' none') ;
8181
8282 manager . setLevel ( 'anonymous' ) ;
8383
@@ -89,13 +89,14 @@ describe('createConsentManager', () => {
8989 'Content-Type' : 'application/json' ,
9090 'x-immutable-publishable-key' : 'pk_test' ,
9191 } ) ,
92+ body : JSON . stringify ( { anonymousId : 'anon-1' , status : 'anonymous' , source : 'pixel' } ) ,
9293 } ) ,
9394 ) ;
9495 } ) ;
9596
9697 it ( 'does nothing when setting the same level' , ( ) => {
9798 const queue = createMockQueue ( ) ;
98- const manager = createConsentManager ( queue , 'pk_test' , 'anon-1' , 'dev' , 'anonymous' ) ;
99+ const manager = createConsentManager ( queue , 'pk_test' , 'anon-1' , 'dev' , 'pixel' , ' anonymous') ;
99100
100101 manager . setLevel ( 'anonymous' ) ;
101102 expect ( queue . purge ) . not . toHaveBeenCalled ( ) ;
@@ -107,7 +108,7 @@ describe('createConsentManager', () => {
107108 Object . defineProperty ( navigator , 'doNotTrack' , { value : '1' , configurable : true } ) ;
108109
109110 const queue = createMockQueue ( ) ;
110- const manager = createConsentManager ( queue , 'pk_test' , 'anon-1' , 'dev' ) ;
111+ const manager = createConsentManager ( queue , 'pk_test' , 'anon-1' , 'dev' , 'pixel' ) ;
111112 expect ( manager . level ) . toBe ( 'none' ) ;
112113
113114 Object . defineProperty ( navigator , 'doNotTrack' , { value : '0' , configurable : true } ) ;
0 commit comments