Skip to content
Snippets Groups Projects
Commit c7189871 authored by Yoan VALLET's avatar Yoan VALLET
Browse files

feat: complete mail service tests

parent e52d1cc9
No related branches found
No related tags found
1 merge request!139Features/unit tests
......@@ -43,7 +43,7 @@ describe('Mail service', () => {
})
describe('CreateBodyWelcome service', () => {
it('should return body mail with the right values when url is compsumption', () => {
it('should return body mail with the right values when url is consumption', () => {
const result: string = mailService.CreateBodyWelcome(
'user',
'https://user-ecolyo.test.com/#/consumption'
......@@ -90,7 +90,7 @@ describe('Mail service', () => {
})
describe('CreateBodyMonthlyReport service', () => {
it('should return body mail with the right values when url', () => {
it('should return body mail with the right values when url is different from bilan', () => {
const result: string = mailService.CreateBodyMonthlyReport(
'user',
'https://user-ecolyo.test.com'
......@@ -107,5 +107,23 @@ describe('Mail service', () => {
)
)
})
it('should return body mail with the right values when url is equals to bilan', () => {
const result: string = mailService.CreateBodyMonthlyReport(
'user',
'https://user-ecolyo.test.com/#/bilan'
)
expect(result).toEqual(expect.stringContaining('Bonjour user'))
expect(result).toEqual(
expect.stringContaining(
'<a class="btnEcolyo" href="https://user-ecolyo.test.com/#/bilan">'
)
)
expect(result).toEqual(
expect.stringContaining(
'<a href="https://user-ecolyo.test.com/#/options" style="color: #ffffff">Unsubscribe</a>'
)
)
})
})
})
......@@ -415,6 +415,8 @@ export default class MailService {
if (!clientUrl.includes('bilan')) {
unsubscibeUrl = clientUrl + '/#/options'
clientUrl = clientUrl + '/#/bilan'
} else {
unsubscibeUrl = clientUrl.replace('bilan', 'options')
}
return `
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional //EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment