-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aae7b3d
commit 9ee2847
Showing
3 changed files
with
66 additions
and
39 deletions.
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
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 |
---|---|---|
|
@@ -864,10 +864,9 @@ describe('iterable utils test', () => { | |
|
||
// Returns appropriate error message for abortable event | ||
|
||
// Processes events with additional dataFields correctly | ||
it('should process events with additional dataFields correctly', () => { | ||
it('should find the right value for which it should fail and passes otherwise', () => { | ||
const event = { | ||
email: 'test@example.com', | ||
email: 'test', | ||
userId: 'user123', | ||
eventName: 'purchase', | ||
dataFields: { customField1: 'value1', customField2: 'value2' }, | ||
|
@@ -876,16 +875,35 @@ describe('iterable utils test', () => { | |
response: { | ||
failCount: 1, | ||
failedUpdates: { | ||
invalidDataEmails: ['value1'], | ||
invalidEmails: ['test'], | ||
}, | ||
}, | ||
}; | ||
const result = checkIfEventIsAbortableAndExtractErrorMessage(event, destinationResponse); | ||
expect(result).toEqual({ | ||
isAbortable: true, | ||
errorMsg: | ||
'Request failed for value "value1" because it is "failedUpdates.invalidDataEmails".', | ||
errorMsg: 'Request failed for value "test" because it is "failedUpdates.invalidEmails".', | ||
}); | ||
}); | ||
|
||
it('should find the right value for which it should fail', () => { | ||
const event = { | ||
email: '[email protected]', | ||
userId: 'user123', | ||
eventName: 'purchase', | ||
dataFields: { customField1: 'test', customField2: 'value2' }, | ||
}; | ||
const destinationResponse = { | ||
response: { | ||
failCount: 1, | ||
failedUpdates: { | ||
invalidEmails: ['test'], | ||
}, | ||
}, | ||
}; | ||
const result = checkIfEventIsAbortableAndExtractErrorMessage(event, destinationResponse); | ||
expect(result.isAbortable).toBe(false); | ||
expect(result.errorMsg).toBe(''); | ||
}); | ||
}); | ||
}); |