Skip to content

Commit

Permalink
name change
Browse files Browse the repository at this point in the history
  • Loading branch information
decemberWP committed May 17, 2024
1 parent 16e3a21 commit 7c961d1
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
20 changes: 10 additions & 10 deletions modules/pirIdSystem.js → modules/ceeIdSystem.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* This module adds pirId to the User ID module
* This module adds ceeId to the User ID module
* The {@link module:modules/userId} module is required
* @module modules/pirId
* @module modules/ceeId
* @requires module:modules/userId
*/

Expand All @@ -15,7 +15,7 @@ import {domainOverrideToRootDomain} from '../libraries/domainOverrideToRootDomai
* @typedef {import('../modules/userId/index.js').IdResponse} IdResponse
*/

const MODULE_NAME = 'pirId';
const MODULE_NAME = 'ceeId';
const ID_TOKEN = 'WPxid';
export const storage = getStorageManager({ moduleName: MODULE_NAME, moduleType: MODULE_TYPE_UID });

Expand All @@ -26,7 +26,7 @@ export const storage = getStorageManager({ moduleName: MODULE_NAME, moduleType:
export const readId = () => storage.getDataFromLocalStorage(ID_TOKEN) || storage.getCookie(ID_TOKEN);

/** @type {Submodule} */
export const pirIdSubmodule = {
export const ceeIdSubmodule = {
name: MODULE_NAME,
gvlid: 676,

Expand All @@ -37,7 +37,7 @@ export const pirIdSubmodule = {
* @returns {(Object|undefined)}
*/
decode(value) {
return typeof value === 'string' ? { 'pirId': value } : undefined;
return typeof value === 'string' ? { 'ceeId': value } : undefined;
},

/**
Expand All @@ -46,17 +46,17 @@ export const pirIdSubmodule = {
* @returns {(IdResponse|undefined)}
*/
getId() {
const pirIdToken = readId();
const ceeIdToken = readId();

return pirIdToken ? { id: pirIdToken } : undefined;
return ceeIdToken ? { id: ceeIdToken } : undefined;
},
domainOverride: domainOverrideToRootDomain(storage, MODULE_NAME),
eids: {
'pirId': {
source: 'pir.wp.pl',
'ceeId': {
source: 'ceeid.eu',
atype: 1
},
},
};

submodule('userId', pirIdSubmodule);
submodule('userId', ceeIdSubmodule);
8 changes: 4 additions & 4 deletions modules/pirIdSystem.md → modules/ceeIdSystem.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Overview

Module Name: pirIDSystem
Module Name: ceeIdSystem
Module Type: UserID Module
Maintainer: pawel.grudzien@grupawp.pl

Expand All @@ -14,13 +14,13 @@ User identification system for WPM
pbjs.setConfig({
userSync: {
userIds: [{
name: 'pirID',
name: 'ceeId',
storage: {
type: 'cookie',
name: 'pirIdToken',
name: 'ceeIdToken',
expires: 7,
refreshInSeconds: 360
},
}
}]
}
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { pirIdSubmodule, storage, readId } from 'modules/pirIdSystem.js';
import { ceeIdSubmodule, storage, readId } from 'modules/ceeIdSystem.js';
import sinon from 'sinon';

describe('pirIdSystem', () => {
describe('ceeIdSystem', () => {
let sandbox;
let getCookieStub;
let getDataFromLocalStorageStub;
Expand All @@ -17,31 +17,31 @@ describe('pirIdSystem', () => {
});

describe('getId', () => {
it('should return an object with id when pirIdToken is found', () => {
it('should return an object with id when ceeIdToken is found', () => {
getDataFromLocalStorageStub.returns('testToken');
getCookieStub.returns('testToken');

const result = pirIdSubmodule.getId();
const result = ceeIdSubmodule.getId();

expect(result).to.deep.equal({ id: 'testToken' });
});

it('should return undefined when pirIdToken is not found', () => {
const result = pirIdSubmodule.getId();
it('should return undefined when ceeIdToken is not found', () => {
const result = ceeIdSubmodule.getId();

expect(result).to.be.undefined;
});
});

describe('decode', () => {
it('should return an object with pirId when value is a string', () => {
const result = pirIdSubmodule.decode('testId');
it('should return an object with ceeId when value is a string', () => {
const result = ceeIdSubmodule.decode('testId');

expect(result).to.deep.equal({ pirId: 'testId' });
expect(result).to.deep.equal({ ceeId: 'testId' });
});

it('should return undefined when value is not a string', () => {
const result = pirIdSubmodule.decode({});
const result = ceeIdSubmodule.decode({});

expect(result).to.be.undefined;
});
Expand Down

0 comments on commit 7c961d1

Please sign in to comment.