-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE] Ajouter un bouton pour renvoyer l'invitation à un centre de…
- Loading branch information
Showing
20 changed files
with
178 additions
and
21 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
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
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
2 changes: 2 additions & 0 deletions
2
admin/tests/integration/components/certification-centers/invitations-test.gjs
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 |
---|---|---|
|
@@ -85,5 +85,58 @@ module('Unit | Controller | authenticated/certification-centers/get/invitations' | |
sinon.assert.calledWith(notificationErrorStub, { message: 'Une erreur s’est produite, veuillez réessayer.' }); | ||
assert.ok(true); | ||
}); | ||
|
||
module('#sendNewInvitation', function () { | ||
test('It sends a new invitation', async function (assert) { | ||
// given | ||
const controller = this.owner.lookup('controller:authenticated/certification-centers/get/invitations'); | ||
|
||
const store = this.owner.lookup('service:store'); | ||
const queryRecordStub = sinon.stub(); | ||
store.queryRecord = queryRecordStub; | ||
const certificationCenterInvitation = { | ||
email: '[email protected]', | ||
language: 'en', | ||
role: 'member', | ||
certificationCenterId: 1, | ||
}; | ||
// when | ||
await controller.sendNewCertificationCenterInvitation(certificationCenterInvitation); | ||
|
||
// then | ||
assert.ok( | ||
queryRecordStub.calledWith('certification-center-invitation', { | ||
...certificationCenterInvitation, | ||
}), | ||
); | ||
}); | ||
|
||
test('When an error occurs, it should send a notification error', async function (assert) { | ||
// given | ||
const controller = this.owner.lookup('controller:authenticated/certification-centers/get/invitations'); | ||
const store = this.owner.lookup('service:store'); | ||
const anError = Symbol('an error'); | ||
store.queryRecord = sinon.stub().rejects(anError); | ||
const notifyStub = sinon.stub(); | ||
class ErrorResponseHandler extends Service { | ||
notify = notifyStub; | ||
} | ||
this.owner.register('service:error-response-handler', ErrorResponseHandler); | ||
const customErrors = Symbol('custom errors'); | ||
controller.CUSTOM_ERROR_MESSAGES = customErrors; | ||
const certificationCenterInvitation = { | ||
email: '[email protected]', | ||
language: 'en', | ||
role: 'member', | ||
certificationCenterId: 1, | ||
}; | ||
|
||
// when | ||
await controller.sendNewCertificationCenterInvitation(certificationCenterInvitation); | ||
|
||
// then | ||
assert.ok(notifyStub.calledWithExactly(anError, customErrors)); | ||
}); | ||
}); | ||
}); | ||
}); |
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 |
---|---|---|
|
@@ -8,6 +8,7 @@ const buildCertificationCenterInvitation = function ({ | |
email = '[email protected]', | ||
status = 'pending', | ||
role = 'MEMBER', | ||
locale = 'fr', | ||
code = 'ABCDEF123', | ||
createdAt = new Date(), | ||
updatedAt = new Date(), | ||
|
@@ -18,6 +19,7 @@ const buildCertificationCenterInvitation = function ({ | |
email, | ||
status, | ||
role, | ||
locale, | ||
code, | ||
createdAt, | ||
updatedAt, | ||
|
16 changes: 16 additions & 0 deletions
16
.../migrations/20250128112736_add-locale-column-to-certification-center-invitations-table.js
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const TABLE_NAME = 'certification-center-invitations'; | ||
const COLUMN_NAME = 'locale'; | ||
|
||
const up = async function (knex) { | ||
await knex.schema.table(TABLE_NAME, function (table) { | ||
table.string(COLUMN_NAME).defaultTo('fr'); | ||
}); | ||
}; | ||
|
||
const down = async function (knex) { | ||
await knex.schema.table(TABLE_NAME, function (table) { | ||
table.dropColumn(COLUMN_NAME); | ||
}); | ||
}; | ||
|
||
export { down, up }; |
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
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
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
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 |
---|---|---|
|
@@ -58,6 +58,7 @@ describe('Acceptance | Team | Application | Route | Admin | Certification Center | |
attributes: { | ||
email: '[email protected]', | ||
role: 'MEMBER', | ||
language: 'fr', | ||
'updated-at': now, | ||
}, | ||
}, | ||
|
@@ -67,6 +68,7 @@ describe('Acceptance | Team | Application | Route | Admin | Certification Center | |
attributes: { | ||
email: '[email protected]', | ||
role: 'ADMIN', | ||
language: 'fr', | ||
'updated-at': now, | ||
}, | ||
}, | ||
|
@@ -119,6 +121,7 @@ describe('Acceptance | Team | Application | Route | Admin | Certification Center | |
'updated-at': now, | ||
email: '[email protected]', | ||
role: 'ADMIN', | ||
language: 'fr', | ||
}); | ||
}); | ||
}); | ||
|
Oops, something went wrong.