Skip to content

Commit 617445b

Browse files
Rename hashedAttributes to hashAttributes
1 parent 1918bf1 commit 617445b

2 files changed

Lines changed: 22 additions & 23 deletions

File tree

src/Rokt-Kit.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ var constructor = function () {
3333
/**
3434
* Passes attributes to the Rokt Web SDK for server-side hashing
3535
* @param {Object} attributes - The attributes to be hashed
36-
* @returns {Object} The hashed attributes from the launcher
36+
* @returns {Object|null} The hashed attributes from the launcher, or `null` if the kit is not initialized
3737
*/
38-
function hashedAttributes(attributes) {
38+
function hashAttributes(attributes) {
3939
if (!isInitialized()) {
4040
console.error('Rokt Kit: Not initialized');
4141
return null;
4242
}
43-
return self.launcher.hashedAttributes(attributes);
43+
return self.launcher.hashAttributes(attributes);
4444
}
4545

4646
function initForwarder(
@@ -248,10 +248,9 @@ var constructor = function () {
248248
return {};
249249
}
250250

251-
252251
// Called by the mParticle Rokt Manager
253252
this.selectPlacements = selectPlacements;
254-
this.hashedAttributes = hashedAttributes;
253+
this.hashAttributes = hashAttributes;
255254

256255
// Kit Callback Methods
257256
this.init = initForwarder;

test/src/tests.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ describe('Rokt Forwarder', () => {
189189
});
190190
});
191191

192-
describe('#hashedAttributes', () => {
192+
describe('#hashAttributes', () => {
193193
beforeEach(() => {
194194
window.Rokt = new MockRoktForwarder();
195195
window.mParticle.Rokt = window.Rokt;
@@ -200,27 +200,27 @@ describe('Rokt Forwarder', () => {
200200
Promise.resolve();
201201
};
202202
window.mParticle.forwarder.launcher = {
203-
hashedAttributes: function (attributes) {
204-
window.mParticle.Rokt.hashedAttributesOptions = attributes;
205-
window.mParticle.Rokt.hashedAttributesCalled = true;
203+
hashAttributes: function (attributes) {
204+
window.mParticle.Rokt.hashAttributesOptions = attributes;
205+
window.mParticle.Rokt.hashAttributesCalled = true;
206206

207-
// Mocking the hashedAttributes method to show that
207+
// Mocking the hashAttributes method to show that
208208
// the attributes will be transformed by the launcher's
209-
// hashedAttributes method.
209+
// hashAttributes method.
210210
return Promise.resolve({
211211
'test-attribute': 'hashed-value',
212212
});
213213
},
214214
};
215215
});
216216

217-
it('should call launcher.hashedAttributes with passed through attributes when fully initialized', function () {
217+
it('should call launcher.hashAttributes with passed through attributes when fully initialized', function () {
218218
// Ensure both initialization conditions are met
219219
window.mParticle.forwarder.isInitialized = true;
220220
window.mParticle.forwarder.launcher = {
221-
hashedAttributes: function (attributes) {
222-
window.mParticle.Rokt.hashedAttributesOptions = attributes;
223-
window.mParticle.Rokt.hashedAttributesCalled = true;
221+
hashAttributes: function (attributes) {
222+
window.mParticle.Rokt.hashAttributesOptions = attributes;
223+
window.mParticle.Rokt.hashAttributesCalled = true;
224224
return {
225225
'test-attribute': 'hashed-value',
226226
};
@@ -231,20 +231,20 @@ describe('Rokt Forwarder', () => {
231231
'test-attribute': 'test-value',
232232
};
233233

234-
window.mParticle.forwarder.hashedAttributes(attributes);
234+
window.mParticle.forwarder.hashAttributes(attributes);
235235

236-
window.Rokt.hashedAttributesCalled.should.equal(true);
237-
window.Rokt.hashedAttributesOptions.should.deepEqual(attributes);
236+
window.Rokt.hashAttributesCalled.should.equal(true);
237+
window.Rokt.hashAttributesOptions.should.deepEqual(attributes);
238238
});
239239

240240
it('should return null when launcher exists but kit is not initialized', function () {
241241
// Set launcher but ensure isInitialized is false
242242
window.mParticle.forwarder.isInitialized = false;
243243
window.mParticle.forwarder.launcher = {
244-
hashedAttributes: function () {},
244+
hashAttributes: function () {},
245245
};
246246

247-
var result = window.mParticle.forwarder.hashedAttributes({
247+
var result = window.mParticle.forwarder.hashAttributes({
248248
'test-attribute': 'test-value',
249249
});
250250

@@ -263,7 +263,7 @@ describe('Rokt Forwarder', () => {
263263
window.mParticle.forwarder.isInitialized = false;
264264
window.mParticle.forwarder.launcher = null;
265265

266-
window.mParticle.forwarder.hashedAttributes({
266+
window.mParticle.forwarder.hashAttributes({
267267
'test-attribute': 'test-value',
268268
});
269269

@@ -276,7 +276,7 @@ describe('Rokt Forwarder', () => {
276276
window.mParticle.forwarder.isInitialized = true;
277277
window.mParticle.forwarder.launcher = null;
278278

279-
var result = window.mParticle.forwarder.hashedAttributes({
279+
var result = window.mParticle.forwarder.hashAttributes({
280280
'test-attribute': 'test-value',
281281
});
282282

@@ -294,7 +294,7 @@ describe('Rokt Forwarder', () => {
294294
{}
295295
);
296296

297-
const result = await window.mParticle.forwarder.hashedAttributes({
297+
const result = await window.mParticle.forwarder.hashAttributes({
298298
'test-attribute': 'test-value',
299299
});
300300

0 commit comments

Comments
 (0)