-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix made/receive donation notification by allowing donationEthValue b…
…e null related to Giveth/giveth-dapps-v2#3552
- Loading branch information
1 parent
ad68ca4
commit 231aa95
Showing
2 changed files
with
130 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1399,6 +1399,49 @@ function sendNotificationTestCases() { | |
assert.isOk(result.data); | ||
assert.isTrue(result.data.success); | ||
}); | ||
it('should create *Made donation* notification, success, segment is on, donationValueEth is null', async () => { | ||
const data = { | ||
eventName: 'Made donation', | ||
sendEmail: true, | ||
sendSegment: true, | ||
userWalletAddress: generateRandomEthereumAddress(), | ||
metadata: { | ||
projectTitle, | ||
projectLink, | ||
}, | ||
segment: { | ||
analyticsUserId: 'givethId-255', | ||
anonymousId: 'givethId-255', | ||
payload: { | ||
email: '[email protected]', | ||
title: 'How many photos is too many photos?', | ||
firstName: 'firstName', | ||
projectOwnerId: '68', | ||
slug: 'how-many-photos-is-too-many-photos', | ||
amount: 0.0001, | ||
transactionId: generateRandomTxHash(), | ||
transactionNetworkId: 5, | ||
currency: 'ETH', | ||
createdAt: '2022-11-10T07:36:13.182Z', | ||
toWalletAddress: generateRandomEthereumAddress(), | ||
donationValueUsd: 0.120492, | ||
donationValueEth: null, | ||
verified: true, | ||
transakStatus: null, | ||
fromWalletAddress: generateRandomEthereumAddress(), | ||
}, | ||
}, | ||
}; | ||
|
||
const result = await axios.post(sendNotificationUrl, data, { | ||
headers: { | ||
authorization: getGivethIoBasicAuth(), | ||
}, | ||
}); | ||
assert.equal(result.status, 200); | ||
assert.isOk(result.data); | ||
assert.isTrue(result.data.success); | ||
}); | ||
it('should create *Made donation* notification, failed invalid metadata, segment is off', async () => { | ||
try { | ||
const data = { | ||
|
@@ -1427,6 +1470,92 @@ function sendNotificationTestCases() { | |
} | ||
}); | ||
|
||
it('should create *Donation received* notification, success, segment is on', async () => { | ||
const data = { | ||
eventName: 'Donation received', | ||
sendEmail: true, | ||
sendSegment: true, | ||
userWalletAddress: generateRandomEthereumAddress(), | ||
metadata: { | ||
projectTitle, | ||
projectLink, | ||
}, | ||
segment: { | ||
analyticsUserId: 'givethId-255', | ||
anonymousId: 'givethId-255', | ||
payload: { | ||
email: '[email protected]', | ||
title: 'How many photos is too many photos?', | ||
firstName: 'firstName', | ||
projectOwnerId: '68', | ||
slug: 'how-many-photos-is-too-many-photos', | ||
amount: 0.0001, | ||
transactionId: generateRandomTxHash(), | ||
transactionNetworkId: 5, | ||
currency: 'ETH', | ||
createdAt: '2022-11-10T07:36:13.182Z', | ||
toWalletAddress: generateRandomEthereumAddress(), | ||
donationValueUsd: 0.120492, | ||
donationValueEth: 0.0001, | ||
verified: true, | ||
transakStatus: null, | ||
fromWalletAddress: generateRandomEthereumAddress(), | ||
}, | ||
}, | ||
}; | ||
|
||
const result = await axios.post(sendNotificationUrl, data, { | ||
headers: { | ||
authorization: getGivethIoBasicAuth(), | ||
}, | ||
}); | ||
assert.equal(result.status, 200); | ||
assert.isOk(result.data); | ||
assert.isTrue(result.data.success); | ||
}); | ||
it('should create *Donation received* notification, success, segment is on, donationValueEth is null', async () => { | ||
const data = { | ||
eventName: 'Donation received', | ||
sendEmail: true, | ||
sendSegment: true, | ||
userWalletAddress: generateRandomEthereumAddress(), | ||
metadata: { | ||
projectTitle, | ||
projectLink, | ||
}, | ||
segment: { | ||
analyticsUserId: 'givethId-255', | ||
anonymousId: 'givethId-255', | ||
payload: { | ||
email: '[email protected]', | ||
title: 'How many photos is too many photos?', | ||
firstName: 'firstName', | ||
projectOwnerId: '68', | ||
slug: 'how-many-photos-is-too-many-photos', | ||
amount: 0.0001, | ||
transactionId: generateRandomTxHash(), | ||
transactionNetworkId: 5, | ||
currency: 'ETH', | ||
createdAt: '2022-11-10T07:36:13.182Z', | ||
toWalletAddress: generateRandomEthereumAddress(), | ||
donationValueUsd: 0.120492, | ||
donationValueEth: null, | ||
verified: true, | ||
transakStatus: null, | ||
fromWalletAddress: generateRandomEthereumAddress(), | ||
}, | ||
}, | ||
}; | ||
|
||
const result = await axios.post(sendNotificationUrl, data, { | ||
headers: { | ||
authorization: getGivethIoBasicAuth(), | ||
}, | ||
}); | ||
assert.equal(result.status, 200); | ||
assert.isOk(result.data); | ||
assert.isTrue(result.data.success); | ||
}); | ||
it('should create *Donation received* notification, success, segment is off', async () => { | ||
const data = { | ||
eventName: 'Donation received', | ||
|
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