generated from adobe/aem-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MWPW-156866 [MILO][MEP] Create martech metadata table if placeholders are used in non EN page #2780
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
fcca29e
Initial checkin - Working state.
AdobeLinhart 488627b
Optimization. Good State.
AdobeLinhart 3495e9c
Semi-colon fix.
AdobeLinhart e915779
Linting fixes.
AdobeLinhart 52287ed
Unit test file creation.
AdobeLinhart e131564
Placeholders update/fix.
AdobeLinhart 48952e6
Fixed US data values.
AdobeLinhart f8e7bf5
Unit testing WIP.
AdobeLinhart c849df0
fix unit test
vgoodric dc67870
unit test working
vgoodric b532778
add before each
vgoodric 9fb40a0
fix linter issue of using same name above
vgoodric 177db35
update processTrackingLabels
vgoodric 1722063
add coverage to attributes.js unit test
vgoodric a500f50
Unit test updates.
AdobeLinhart File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
test/features/personalization/createMartechMetadata.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { expect } from '@esm-bundle/chai'; | ||
import { createMartechMetadata } from '../../../libs/features/personalization/personalization.js'; | ||
import placeholders from './mocks/placeholders.js'; | ||
|
||
const config = { | ||
locale: { ietf: 'fr-fr' }, | ||
mep: {}, | ||
}; | ||
|
||
// Note that the manifestPath doesn't matter as we stub the fetch | ||
describe('test martech metadata creation', () => { | ||
beforeEach(() => { | ||
config.mep = {}; | ||
}); | ||
it('test two non US manifests', async () => { | ||
expect(config.mep).to.deep.equal({}); | ||
|
||
await createMartechMetadata(placeholders.geoTest, config, 'fr'); | ||
expect(config.mep.analyticLocalization).to.deep.equal({ | ||
'value1 fr': 'value1 en us', | ||
'value2 fr': 'value2 en us', | ||
'bonjour fr': 'Hello en us', | ||
'buy now fr': 'buy now en us', | ||
'try now fr': 'try now en us', | ||
}); | ||
await createMartechMetadata(placeholders.secondManifestTest, config, 'fr'); | ||
expect(config.mep.analyticLocalization).to.deep.equal({ | ||
'new fr': 'new en us', | ||
'value1 fr': 'value1 en us', | ||
'value2 fr': 'new2 en us', | ||
'bonjour fr': 'Hello en us', | ||
'buy now fr': 'buy now en us', | ||
'try now fr': 'try now en us', | ||
}); | ||
}); | ||
it('test one manifest non US withou en-us keys', async () => { | ||
await createMartechMetadata(placeholders.keyTest, config, 'fr'); | ||
expect(config.mep.analyticLocalization).to.deep.equal({ | ||
'value1 fr': 'test placeholder', | ||
'value2 fr': 'test placeholder2', | ||
'bonjour fr': 'marquee headline', | ||
'buy now fr': 'marquee hollow', | ||
'try now fr': 'marquee solid', | ||
}); | ||
}); | ||
it('test one manifest en-US', async () => { | ||
config.locale.ietf = 'en-US'; | ||
await createMartechMetadata(placeholders.keyTest, config, 'us'); | ||
expect(config.mep).to.deep.equal({}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
const placeholders = { | ||
geoTest: [ | ||
{ | ||
key: 'test-placeholder', | ||
'mobile-device & us': 'US Mobile Value', | ||
us: 'value1-us', | ||
'en-us': 'value1-en-us', | ||
'ca & not fr': 'value1-ca-not-fr', | ||
fr: 'value1-fr', | ||
'mobile-device': 'value1-mobile', | ||
}, | ||
{ | ||
key: 'test-placeholder2', | ||
'mobile-device & us': 'US Mobile Value2', | ||
us: 'value2-us', | ||
'en-us': 'value2-en-us', | ||
'ca & not fr': 'value2-ca-not-fr', | ||
fr: 'value2-fr', | ||
'mobile-device': 'value2-mobile', | ||
}, | ||
{ | ||
key: 'marquee-headline', | ||
'mobile-device & us': 'hello US mobile', | ||
us: 'hello-us', | ||
'en-us': 'Hello-en-us', | ||
'ca & not fr': 'hello-ca-not-fr', | ||
fr: 'bonjour-fr', | ||
'mobile-device': 'hello-mobile', | ||
}, | ||
{ | ||
key: 'marquee-hollow', | ||
'mobile-device & us': 'buy-now-mobile-us', | ||
us: 'buy-now-us', | ||
'en-us': 'buy-now-en-us', | ||
'ca & not fr': 'buy-now-ca-not-fr', | ||
fr: 'buy-now-fr', | ||
'mobile-device': 'buy-now-mobile', | ||
}, | ||
{ | ||
key: 'marquee-solid', | ||
'mobile-device & us': 'try-now-mobile-us', | ||
us: 'try-now-us', | ||
'en-us': 'try-now-en-us', | ||
'ca & not fr': 'try-now-ca-not-fr', | ||
fr: 'try-now-fr', | ||
'mobile-device': 'try-now-mobile', | ||
}, | ||
], | ||
secondManifestTest: [ | ||
{ | ||
key: 'test-placeholder', | ||
'mobile-device & us': 'US Mobile Value', | ||
us: 'value1-us', | ||
'en-us': 'new-en-us', | ||
'ca & not fr': 'value1-ca-not-fr', | ||
fr: 'new-fr', | ||
'mobile-device': 'value1-mobile', | ||
}, | ||
{ | ||
key: 'test-placeholder2', | ||
'mobile-device & us': 'US Mobile Value2', | ||
us: 'value2-us', | ||
'en-us': 'new2-en-us', | ||
'ca & not fr': 'value2-ca-not-fr', | ||
fr: 'value2-fr', | ||
'mobile-device': 'value2-mobile', | ||
}, | ||
], | ||
keyTest: [ | ||
{ | ||
key: 'test-placeholder', | ||
'mobile-device & us': 'US Mobile Value', | ||
fr: 'value1-fr', | ||
'mobile-device': 'value1-mobile', | ||
}, | ||
{ | ||
key: 'test-placeholder2', | ||
'mobile-device & us': 'US Mobile Value2', | ||
fr: 'value2-fr', | ||
'mobile-device': 'value2-mobile', | ||
}, | ||
{ | ||
key: 'marquee-headline', | ||
'mobile-device & us': 'hello US mobile', | ||
fr: 'bonjour-fr', | ||
'mobile-device': 'hello-mobile', | ||
}, | ||
{ | ||
key: 'marquee-hollow', | ||
'mobile-device & us': 'buy-now-mobile-us', | ||
fr: 'buy-now-fr', | ||
'mobile-device': 'buy-now-mobile', | ||
}, | ||
{ | ||
key: 'marquee-solid', | ||
'mobile-device & us': 'try-now-mobile-us', | ||
fr: 'try-now-fr', | ||
'mobile-device': 'try-now-mobile', | ||
}, | ||
], | ||
}; | ||
|
||
export default placeholders; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd be a bit careful with those imports as they block the pipeline and we aren't loading things in parallel.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's a bit of a case-study I did on project unity on this: adobecom/unity#102