Commit 2b30d7ee authored by Guy Thouret's avatar Guy Thouret

(feat) Split for rewards_state_change notification template to separate...

(feat) Split for rewards_state_change notification template to separate increase and decrease templates - #1582
1 merge request!464WIP: Rewards Notifications
Pipeline #73234993 failed with stages
in 35 minutes and 56 seconds
......@@ -710,14 +710,26 @@
</a>
</ng-template>
<ng-template ngSwitchCase="rewards_state_change">
<ng-template ngSwitchCase="rewards_state_increase">
<a
target="_blank"
routerLink="/wallet/tokens/contributions"
>
<p i18n="@@NOTIFICATIONS__NOTIFICATION__REWARDS__USER_STATE_CHANGE">
You just became a {{notification.params.state}} user.
Your new token reward multiplier is {{notification.params.reward_factor}}x
<p i18n="@@NOTIFICATIONS__NOTIFICATION__REWARDS__USER_STATE_INCREASE">
Congratulations! You just became a {{notification.params.state}} user.
We've increased your daily token reward multiplier to {{notification.params.reward_factor}}x
</p>
</a>
</ng-template>
<ng-template ngSwitchCase="rewards_state_decrease">
<a
target="_blank"
routerLink="/wallet/tokens/contributions"
>
<p i18n="@@NOTIFICATIONS__NOTIFICATION__REWARDS__USER_STATE_DECREASE">
We miss you! You just dropped down to a {{notification.params.state}} user.
Your daily token reward multiplier has been reduced to {{notification.params.reward_factor}}x
</p>
</a>
</ng-template>
......
......@@ -566,11 +566,11 @@ describe('NotificationsComponent', () => {
expect(notification.nativeElement.innerHTML).toBe('this is a mesage');
});
it('Should load the notification rewards_state_change', () => {
it('Should load the notification rewards_state_increase', () => {
comp.notification = {
'type': 'notification',
'guid': '843204301747658770',
'notification_view': 'rewards_state_change',
'notification_view': 'rewards_state_increase',
'entityObj': null,
'fromObj': {
name: 'name'
......@@ -582,12 +582,39 @@ describe('NotificationsComponent', () => {
previous_state: null,
activity_percentage: '0.29',
reward_factor: 1.5,
previous_reward_factor: 1
previous_reward_factor: 1,
state_change: 3
}
};
fixture.detectChanges();
expect(comp.notification).not.toBeNull();
const notification = fixture.debugElement.query(By.css('p'));
expect(notification.nativeElement.innerHTML).toContain('You just became a casual user.');
expect(notification.nativeElement.innerHTML).toContain('Congratulations! You just became a casual user');
});
it('Should load the notification rewards_state_decrease', () => {
comp.notification = {
'type': 'notification',
'guid': '843204301747658770',
'notification_view': 'rewards_state_decrease',
'entityObj': null,
'fromObj': {
name: 'name'
},
'params' : {
user_guid: '998551699243143177',
reference_date: 1563753600000,
state: 'casual',
previous_state: 'core',
activity_percentage: '0.29',
reward_factor: 1.5,
previous_reward_factor: 1,
state_change: -2
}
};
fixture.detectChanges();
expect(comp.notification).not.toBeNull();
const notification = fixture.debugElement.query(By.css('p'));
expect(notification.nativeElement.innerHTML).toContain('You just dropped down to a casual user');
});
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment