Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ export interface Payload {
*/
memora_store: string
/**
* Contact identifiers (email and/or phone). At least one identifier is required.
* Profile identifiers (email and/or phone). At least one identifier is required. These identifiers are stored in the Contact trait group.
*/
contact_identifiers: {
profile_identifiers: {
/**
* User email address
*/
Expand All @@ -27,9 +27,9 @@ export interface Payload {
phone?: string
}
/**
* Contact traits for the profile. At least one trait is required. These fields are dynamically loaded from the selected Memora Store.
* Traits for the profile from all trait groups. At least one trait is required. These fields are dynamically loaded from the selected Memora Store. When manually entering keys, use the format "TraitGroupName.$.traitName" (e.g., "Contact.$.firstName", "PurchaseHistory.$.lastPurchaseDate").
*/
contact_traits: {
profile_traits: {
[k: string]: unknown
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ describe(`Testing snapshot for ${destinationSlug} destination:`, () => {
const mapping = {
...event.properties,
memora_store: 'test-store-id',
contact_identifiers: {
profile_identifiers: {
email: 'test@example.com'
},
contact_traits: {
firstName: 'Test'
profile_traits: {
'Contact.$.firstName': 'Test'
}
}

Expand Down Expand Up @@ -80,12 +80,12 @@ describe(`Testing snapshot for ${destinationSlug} destination:`, () => {
const mapping = {
...event.properties,
memora_store: 'test-store-id',
contact_identifiers: {
profile_identifiers: {
email: 'test@example.com'
},
contact_traits: {
firstName: 'Test',
lastName: 'User'
profile_traits: {
'Contact.$.firstName': 'Test',
'Contact.$.lastName': 'User'
}
}

Expand All @@ -107,64 +107,5 @@ describe(`Testing snapshot for ${destinationSlug} destination:`, () => {
expect(rawBody).toMatchSnapshot()
}
})

it(`${actionSlug} action - should throw error when memora_store is missing`, async () => {
const seedName = `${destinationSlug}#${actionSlug}`
const action = destination.actions[actionSlug]
const [eventData, settingsData] = generateTestData(seedName, destination, action, true)

const event = createTestEvent({
properties: eventData
})

const mapping = {
...event.properties,
contact_identifiers: {
email: 'test@example.com'
},
contact_traits: {
firstName: 'Test'
}
}

await expect(
testDestination.testAction(actionSlug, {
event: event,
mapping: mapping,
settings: settingsData,
auth: undefined
})
).rejects.toThrow()
})

it(`${actionSlug} action - should throw error when profile has no traits`, async () => {
const seedName = `${destinationSlug}#${actionSlug}`
const action = destination.actions[actionSlug]
const [eventData, settingsData] = generateTestData(seedName, destination, action, true)

nock(/.*/).persist().get(/.*/).reply(200)
nock(/.*/).persist().post(/.*/).reply(202)
nock(/.*/).persist().put(/.*/).reply(202)

const event = createTestEvent({
properties: eventData
})

const mapping = {
...event.properties,
memora_store: 'test-store-id',
contact_identifiers: {},
contact_traits: {}
}

await expect(
testDestination.testAction(actionSlug, {
event: event,
mapping: mapping,
settings: settingsData,
auth: undefined
})
).rejects.toThrow('No valid profiles found for import')
})
}
})
Loading
Loading