-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(api): send ail with correct locale and lang
Co-Authored-By: Jérémy PLUQUET <[email protected]>
- Loading branch information
1 parent
d430c9a
commit 9215596
Showing
2 changed files
with
28 additions
and
52 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,7 +41,7 @@ describe('Unit | Identity Access Management | Domain | Email | create-warning-co | |
}); | ||
|
||
describe('when the locale is en', function () { | ||
it('provides the correct reset password URL', function () { | ||
it('provides the correct urls', function () { | ||
// given | ||
const emailParams = { | ||
email: '[email protected]', | ||
|
@@ -54,34 +54,19 @@ describe('Unit | Identity Access Management | Domain | Email | create-warning-co | |
const email = createWarningConnectionEmail(emailParams); | ||
|
||
// then | ||
const { resetUrl } = email.variables; | ||
const expectedUrl = | ||
'https://app.pix.org/api/users/validate-email?token=token&redirect_url=https%3A%2F%2Fapp.pix.org%2Fmot-de-passe-oublie%3Flang%3Den'; | ||
expect(resetUrl).to.equal(expectedUrl); | ||
}); | ||
|
||
it('provides the correct help desk URL', function () { | ||
// given | ||
const emailParams = { | ||
email: '[email protected]', | ||
locale: 'en', | ||
firstName: 'John', | ||
validationToken: 'token', | ||
}; | ||
|
||
// when | ||
const email = createWarningConnectionEmail(emailParams); | ||
|
||
// then | ||
const { helpDeskUrl } = email.variables; | ||
const expectedUrl = | ||
const { helpDeskUrl, resetUrl } = email.variables; | ||
const expectedSupportUrl = | ||
'https://app.pix.org/api/users/validate-email?token=token&redirect_url=https%3A%2F%2Fpix.org%2Fen%2Fsupport'; | ||
expect(helpDeskUrl).to.equal(expectedUrl); | ||
|
||
const expectedResetUrl = | ||
'https://app.pix.org/api/users/validate-email?token=token&redirect_url=https%3A%2F%2Fapp.pix.org%2Fmot-de-passe-oublie%3Flang%3Den'; | ||
expect(resetUrl).to.equal(expectedResetUrl); | ||
expect(helpDeskUrl).to.equal(expectedSupportUrl); | ||
}); | ||
}); | ||
|
||
describe('when the locale is fr-fr', function () { | ||
it('provides the correct reset password URL', function () { | ||
it('provides the correct urls', function () { | ||
// given | ||
const emailParams = { | ||
email: '[email protected]', | ||
|
@@ -94,34 +79,18 @@ describe('Unit | Identity Access Management | Domain | Email | create-warning-co | |
const email = createWarningConnectionEmail(emailParams); | ||
|
||
// then | ||
const { resetUrl } = email.variables; | ||
const expectedUrl = | ||
'https://app.pix.fr/api/users/validate-email?token=token&redirect_url=https%3A%2F%2Fapp.pix.fr%2Fmot-de-passe-oublie%3Flang%3Dfr'; | ||
expect(resetUrl).to.equal(expectedUrl); | ||
}); | ||
|
||
it('provides the correct help desk URL', function () { | ||
// given | ||
const emailParams = { | ||
email: '[email protected]', | ||
locale: 'fr-fr', | ||
firstName: 'John', | ||
validationToken: 'token', | ||
}; | ||
|
||
// when | ||
const email = createWarningConnectionEmail(emailParams); | ||
|
||
// then | ||
const { helpDeskUrl } = email.variables; | ||
const expectedUrl = | ||
const { helpDeskUrl, resetUrl } = email.variables; | ||
const expectedSupportUrl = | ||
'https://app.pix.fr/api/users/validate-email?token=token&redirect_url=https%3A%2F%2Fpix.fr%2Fsupport'; | ||
expect(helpDeskUrl).to.equal(expectedUrl); | ||
const expectedResetUrl = | ||
'https://app.pix.fr/api/users/validate-email?token=token&redirect_url=https%3A%2F%2Fapp.pix.fr%2Fmot-de-passe-oublie%3Flang%3Dfr'; | ||
expect(resetUrl).to.equal(expectedResetUrl); | ||
expect(helpDeskUrl).to.equal(expectedSupportUrl); | ||
}); | ||
}); | ||
|
||
describe('when the locale is nl-BE', function () { | ||
it('provides the correct reset password URL', function () { | ||
it('provides the correct urls', function () { | ||
// given | ||
const emailParams = { | ||
email: '[email protected]', | ||
|
@@ -134,11 +103,14 @@ describe('Unit | Identity Access Management | Domain | Email | create-warning-co | |
const email = createWarningConnectionEmail(emailParams); | ||
|
||
// then | ||
const { resetUrl } = email.variables; | ||
const expectedUrl = | ||
const { resetUrl, helpDeskUrl } = email.variables; | ||
const expectedResetUrl = | ||
'https://app.pix.org/api/users/validate-email?token=token&redirect_url=https%3A%2F%2Fapp.pix.org%2Fmot-de-passe-oublie%3Flang%3Dnl'; | ||
|
||
expect(resetUrl).to.equal(expectedUrl); | ||
const expectedSupportUrl = | ||
'https://app.pix.org/api/users/validate-email?token=token&redirect_url=https%3A%2F%2Fpix.org%2Fnl-be%2Fsupport'; | ||
expect(resetUrl).to.equal(expectedResetUrl); | ||
expect(helpDeskUrl).to.equal(expectedSupportUrl); | ||
}); | ||
}); | ||
}); |