1
1
import { sharedIdSystemSubmodule , storage } from 'modules/sharedIdSystem.js' ;
2
2
import { coppaDataHandler } from 'src/adapterManager' ;
3
+ import { config } from 'src/config.js' ;
3
4
4
5
import sinon from 'sinon' ;
5
6
import * as utils from 'src/utils.js' ;
6
7
import { createEidsArray } from '../../../modules/userId/eids.js' ;
7
- import { attachIdSystem } from '../../../modules/userId/index.js' ;
8
+ import { attachIdSystem , init } from '../../../modules/userId/index.js' ;
9
+ import { getGlobal } from '../../../src/prebidGlobal.js' ;
8
10
9
11
let expect = require ( 'chai' ) . expect ;
10
12
@@ -97,6 +99,9 @@ describe('SharedId System', function () {
97
99
before ( ( ) => {
98
100
attachIdSystem ( sharedIdSystemSubmodule ) ;
99
101
} ) ;
102
+ afterEach ( ( ) => {
103
+ config . resetConfig ( ) ;
104
+ } ) ;
100
105
it ( 'pubCommonId' , function ( ) {
101
106
const userId = {
102
107
pubcid : 'some-random-id-value'
@@ -108,5 +113,24 @@ describe('SharedId System', function () {
108
113
uids : [ { id : 'some-random-id-value' , atype : 1 } ]
109
114
} ) ;
110
115
} ) ;
116
+
117
+ it ( 'should set inserter, if provided in config' , async ( ) => {
118
+ config . setConfig ( {
119
+ userSync : {
120
+ userIds : [ {
121
+ name : 'sharedId' ,
122
+ params : {
123
+ inserter : 'mock-inserter'
124
+ } ,
125
+ value : { pubcid : 'mock-id' }
126
+ } ]
127
+ }
128
+ } ) ;
129
+ const eids = getGlobal ( ) . getUserIdsAsEids ( ) ;
130
+ sinon . assert . match ( eids [ 0 ] , {
131
+ source : 'pubcid.org' ,
132
+ inserter : 'mock-inserter'
133
+ } )
134
+ } )
111
135
} )
112
136
} ) ;
0 commit comments