Skip to content

Commit

Permalink
add welcome notificationType
Browse files Browse the repository at this point in the history
  • Loading branch information
cquinterom096 committed Oct 20, 2022
1 parent 5c22901 commit a309fce
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 36 deletions.
18 changes: 18 additions & 0 deletions migrations/1660716115917-seedNotificationType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,24 @@ export const GivethNotificationTypes = {
},
],
},
WELCOME: {
name: 'Welcome',
description: "Welcome to Giveth! ❤️ So happy you're here.",
microService: MICRO_SERVICES.givethio,
category: 'general',
schemaValidator: null,
emailNotifierService: null,
emailNotificationId: null,
pushNotifierService: null,
title: 'Welcome!',
htmlTemplate: [
{
type: 'p',
content: "Welcome to Giveth! ❤️ So happy you're here.",
},
],
content: "Welcome to Giveth! ❤️ So happy you're here.",
},
COMPLETE_PROFILE: {
name: 'The profile has been completed',
description: 'Thanks for completing your profile',
Expand Down
58 changes: 22 additions & 36 deletions src/routes/v1/notificationRouter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1591,7 +1591,6 @@ function sendNotification() {
}
});


it('should create *Failed donation* notification, success, segment is off', async () => {
const data = {
eventName: 'Failed donation',
Expand All @@ -1601,8 +1600,8 @@ function sendNotification() {
metadata: {
projectTitle,
projectLink,
reason:'reason',
txLink:'txLink'
reason: 'reason',
txLink: 'txLink',
},
};

Expand All @@ -1624,8 +1623,8 @@ function sendNotification() {
userWalletAddress: generateRandomEthereumAddress(),
metadata: {
projectLink,
reason:'reason',
txLink:'txLink'
reason: 'reason',
txLink: 'txLink',
},
};

Expand All @@ -1638,15 +1637,13 @@ function sendNotification() {
assert.isTrue(false);
} catch (e: any) {
assert.equal(
e.response.data.message,
errorMessagesEnum.IMPACT_GRAPH_VALIDATION_ERROR.message,
e.response.data.message,
errorMessagesEnum.IMPACT_GRAPH_VALIDATION_ERROR.message,
);
assert.equal(e.response.data.description, '"projectTitle" is required');
}
});



it('should create *Project update - Donors* notification, success, segment is off', async () => {
const data = {
eventName: 'Project update - Donors',
Expand Down Expand Up @@ -1689,14 +1686,13 @@ function sendNotification() {
assert.isTrue(false);
} catch (e: any) {
assert.equal(
e.response.data.message,
errorMessagesEnum.IMPACT_GRAPH_VALIDATION_ERROR.message,
e.response.data.message,
errorMessagesEnum.IMPACT_GRAPH_VALIDATION_ERROR.message,
);
assert.equal(e.response.data.description, '"projectTitle" is required');
}
});


it('should create *Project update* notification, success, segment is off', async () => {
const data = {
eventName: 'Project update',
Expand Down Expand Up @@ -1739,14 +1735,13 @@ function sendNotification() {
assert.isTrue(false);
} catch (e: any) {
assert.equal(
e.response.data.message,
errorMessagesEnum.IMPACT_GRAPH_VALIDATION_ERROR.message,
e.response.data.message,
errorMessagesEnum.IMPACT_GRAPH_VALIDATION_ERROR.message,
);
assert.equal(e.response.data.description, '"projectTitle" is required');
}
});


it('should create *Project update - Donors* notification, success, segment is off', async () => {
const data = {
eventName: 'Project update - Donors',
Expand Down Expand Up @@ -1789,14 +1784,13 @@ function sendNotification() {
assert.isTrue(false);
} catch (e: any) {
assert.equal(
e.response.data.message,
errorMessagesEnum.IMPACT_GRAPH_VALIDATION_ERROR.message,
e.response.data.message,
errorMessagesEnum.IMPACT_GRAPH_VALIDATION_ERROR.message,
);
assert.equal(e.response.data.description, '"projectTitle" is required');
}
});


it('should create *Project update - Users Who Liked* notification, success, segment is off', async () => {
const data = {
eventName: 'Project update - Users Who Liked',
Expand Down Expand Up @@ -1839,15 +1833,13 @@ function sendNotification() {
assert.isTrue(false);
} catch (e: any) {
assert.equal(
e.response.data.message,
errorMessagesEnum.IMPACT_GRAPH_VALIDATION_ERROR.message,
e.response.data.message,
errorMessagesEnum.IMPACT_GRAPH_VALIDATION_ERROR.message,
);
assert.equal(e.response.data.description, '"projectTitle" is required');
}
});



it('should create *Project updated - owner* notification, success, segment is off', async () => {
const data = {
eventName: 'Project updated - owner',
Expand Down Expand Up @@ -1890,14 +1882,13 @@ function sendNotification() {
assert.isTrue(false);
} catch (e: any) {
assert.equal(
e.response.data.message,
errorMessagesEnum.IMPACT_GRAPH_VALIDATION_ERROR.message,
e.response.data.message,
errorMessagesEnum.IMPACT_GRAPH_VALIDATION_ERROR.message,
);
assert.equal(e.response.data.description, '"projectTitle" is required');
}
});


it('should create *Project updated - donor* notification, success, segment is off', async () => {
const data = {
eventName: 'Project updated - donor',
Expand Down Expand Up @@ -1940,14 +1931,13 @@ function sendNotification() {
assert.isTrue(false);
} catch (e: any) {
assert.equal(
e.response.data.message,
errorMessagesEnum.IMPACT_GRAPH_VALIDATION_ERROR.message,
e.response.data.message,
errorMessagesEnum.IMPACT_GRAPH_VALIDATION_ERROR.message,
);
assert.equal(e.response.data.description, '"projectTitle" is required');
}
});


it('should create *Verification form got draft by admin* notification, success, segment is off', async () => {
const data = {
eventName: 'Verification form got draft by admin',
Expand Down Expand Up @@ -1990,14 +1980,13 @@ function sendNotification() {
assert.isTrue(false);
} catch (e: any) {
assert.equal(
e.response.data.message,
errorMessagesEnum.IMPACT_GRAPH_VALIDATION_ERROR.message,
e.response.data.message,
errorMessagesEnum.IMPACT_GRAPH_VALIDATION_ERROR.message,
);
assert.equal(e.response.data.description, '"projectTitle" is required');
}
});


it('should create *project liked* notification, success, segment is off', async () => {
const data = {
eventName: 'project liked',
Expand Down Expand Up @@ -2040,13 +2029,10 @@ function sendNotification() {
assert.isTrue(false);
} catch (e: any) {
assert.equal(
e.response.data.message,
errorMessagesEnum.IMPACT_GRAPH_VALIDATION_ERROR.message,
e.response.data.message,
errorMessagesEnum.IMPACT_GRAPH_VALIDATION_ERROR.message,
);
assert.equal(e.response.data.description, '"projectTitle" is required');
}
});



}

0 comments on commit a309fce

Please sign in to comment.