-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TECH] Affichage d'une erreur spécifique à l'enregistrement d'un candidat lorsque la session est finalisée (PIX-13862) #10248
Merged
alexandrecoin
merged 3 commits into
dev
from
pix-13862-add-specific-error-message-on-403-add-candidate-error
Oct 8, 2024
+54
−102
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
|
@@ -48,10 +48,7 @@ module('Integration | Component | Sessions | SessionDetails | EnrolledCandidates | |
|
||
test('it should have an accessible table description', async function (assert) { | ||
//given | ||
const candidate = _buildCertificationCandidate({ | ||
birthdate: new Date('2019-04-28'), | ||
subscriptions: [], | ||
}); | ||
const candidate = _buildCertificationCandidate({ subscriptions: [] }); | ||
|
||
const certificationCandidates = [store.createRecord('certification-candidate', candidate)]; | ||
const countries = [store.createRecord('country', { name: 'CANADA', code: 99401 })]; | ||
|
@@ -89,7 +86,6 @@ module('Integration | Component | Sessions | SessionDetails | EnrolledCandidates | |
complementaryCertificationId, | ||
}); | ||
const candidate = _buildCertificationCandidate({ | ||
birthdate: new Date('2019-04-28'), | ||
accessibilityAdjustmentNeeded: true, | ||
subscriptions: [coreSubscription, complementarySubscription], | ||
}); | ||
|
@@ -131,9 +127,7 @@ module('Integration | Component | Sessions | SessionDetails | EnrolledCandidates | |
|
||
test('it should display details button', async function (assert) { | ||
// given | ||
const candidate = _buildCertificationCandidate({ | ||
subscriptions: [], | ||
}); | ||
const candidate = _buildCertificationCandidate({ subscriptions: [] }); | ||
const certificationCandidates = [store.createRecord('certification-candidate', candidate)]; | ||
const countries = [store.createRecord('country', { name: 'CANADA', code: 99401 })]; | ||
|
||
|
@@ -158,9 +152,7 @@ module('Integration | Component | Sessions | SessionDetails | EnrolledCandidates | |
|
||
test('it should display details modal', async function (assert) { | ||
// given | ||
const candidate = _buildCertificationCandidate({ | ||
subscriptions: [], | ||
}); | ||
const candidate = _buildCertificationCandidate({ subscriptions: [] }); | ||
const certificationCandidates = [store.createRecord('certification-candidate', candidate)]; | ||
const countries = [store.createRecord('country', { name: 'CANADA', code: 99401 })]; | ||
|
||
|
@@ -190,19 +182,9 @@ module('Integration | Component | Sessions | SessionDetails | EnrolledCandidates | |
test('it should be possible to delete the candidate', async function (assert) { | ||
// given | ||
const certificationCandidates = [ | ||
_buildCertificationCandidate({ | ||
id: 1, | ||
firstName: 'Riri', | ||
lastName: 'Duck', | ||
subscriptions: [], | ||
}), | ||
_buildCertificationCandidate({ id: 2, firstName: 'Fifi', lastName: 'Duck', subscriptions: [] }), | ||
_buildCertificationCandidate({ | ||
id: 3, | ||
firstName: 'Loulou', | ||
lastName: 'Duck', | ||
subscriptions: [], | ||
}), | ||
_buildCertificationCandidate({ id: '1' }), | ||
_buildCertificationCandidate({ id: '2', firstName: 'Lara', lastName: 'Pafromage' }), | ||
_buildCertificationCandidate({ id: '3', firstName: 'Jean', lastName: 'Registre' }), | ||
].map((candidateData) => store.createRecord('certification-candidate', candidateData)); | ||
const countries = [store.createRecord('country', { name: 'CANADA', code: 99401 })]; | ||
|
||
|
@@ -221,7 +203,7 @@ module('Integration | Component | Sessions | SessionDetails | EnrolledCandidates | |
</template>, | ||
); | ||
|
||
await click(screen.getByRole('button', { name: 'Supprimer le candidat Riri Duck' })); | ||
await click(screen.getByRole('button', { name: 'Supprimer le candidat Eddy Taurial' })); | ||
|
||
// then | ||
sinon.assert.calledOnce(certificationCandidates[0].destroyRecord); | ||
|
@@ -235,21 +217,9 @@ module('Integration | Component | Sessions | SessionDetails | EnrolledCandidates | |
test('it display candidates with delete button disabled', async function (assert) { | ||
// given | ||
const certificationCandidates = [ | ||
_buildCertificationCandidate({ | ||
id: 1, | ||
firstName: 'Riri', | ||
lastName: 'Duck', | ||
isLinked: false, | ||
subscriptions: [], | ||
}), | ||
_buildCertificationCandidate({ id: 2, firstName: 'Fifi', lastName: 'Duck', isLinked: true, subscriptions: [] }), | ||
_buildCertificationCandidate({ | ||
id: 3, | ||
firstName: 'Loulou', | ||
lastName: 'Duck', | ||
isLinked: false, | ||
subscriptions: [], | ||
}), | ||
_buildCertificationCandidate({ id: '1' }), | ||
_buildCertificationCandidate({ id: '2', firstName: 'Lara', lastName: 'Pafromage', isLinked: true }), | ||
_buildCertificationCandidate({ id: '3', firstName: 'Jean', lastName: 'Registre' }), | ||
].map((candidateData) => store.createRecord('certification-candidate', candidateData)); | ||
const countries = [store.createRecord('country', { name: 'CANADA', code: 99401 })]; | ||
|
||
|
@@ -266,13 +236,13 @@ module('Integration | Component | Sessions | SessionDetails | EnrolledCandidates | |
|
||
// then | ||
assert | ||
.dom(screen.getByRole('button', { name: 'Supprimer le candidat Riri Duck' })) | ||
.dom(screen.getByRole('button', { name: 'Supprimer le candidat Eddy Taurial' })) | ||
.hasClass(DELETE_BUTTON_SELECTOR); | ||
assert | ||
.dom(screen.getByRole('button', { name: 'Supprimer le candidat Fifi Duck' })) | ||
.dom(screen.getByRole('button', { name: 'Supprimer le candidat Lara Pafromage' })) | ||
.hasClass(DELETE_BUTTON_DISABLED_SELECTOR); | ||
assert | ||
.dom(screen.getByRole('button', { name: 'Supprimer le candidat Loulou Duck' })) | ||
.dom(screen.getByRole('button', { name: 'Supprimer le candidat Jean Registre' })) | ||
.hasClass(DELETE_BUTTON_SELECTOR); | ||
}); | ||
}); | ||
|
@@ -308,27 +278,9 @@ module('Integration | Component | Sessions | SessionDetails | EnrolledCandidates | |
test('it display candidates with an edit button', async function (assert) { | ||
// given | ||
const certificationCandidates = [ | ||
_buildCertificationCandidate({ | ||
id: 1, | ||
firstName: 'Riri', | ||
lastName: 'Duck', | ||
isLinked: false, | ||
subscriptions: [], | ||
}), | ||
_buildCertificationCandidate({ | ||
id: 2, | ||
firstName: 'Fifi', | ||
lastName: 'Duck', | ||
isLinked: true, | ||
subscriptions: [], | ||
}), | ||
_buildCertificationCandidate({ | ||
id: 3, | ||
firstName: 'Loulou', | ||
lastName: 'Duck', | ||
isLinked: false, | ||
subscriptions: [], | ||
}), | ||
_buildCertificationCandidate({ id: '1' }), | ||
_buildCertificationCandidate({ id: '2', firstName: 'Lara', lastName: 'Pafromage', isLinked: true }), | ||
_buildCertificationCandidate({ id: '3', firstName: 'Jean', lastName: 'Registre' }), | ||
].map((candidateData) => store.createRecord('certification-candidate', candidateData)); | ||
const countries = [store.createRecord('country', { name: 'CANADA', code: 99401 })]; | ||
|
||
|
@@ -346,12 +298,14 @@ module('Integration | Component | Sessions | SessionDetails | EnrolledCandidates | |
// then | ||
|
||
// then | ||
assert.dom(screen.getByRole('button', { name: 'Editer le candidat Riri Duck' })).hasClass(EDIT_BUTTON_SELECTOR); | ||
assert | ||
.dom(screen.getByRole('button', { name: 'Editer le candidat Fifi Duck' })) | ||
.dom(screen.getByRole('button', { name: 'Editer le candidat Eddy Taurial' })) | ||
.hasClass(EDIT_BUTTON_SELECTOR); | ||
assert | ||
.dom(screen.getByRole('button', { name: 'Editer le candidat Lara Pafromage' })) | ||
.hasClass(EDIT_BUTTON_DISABLED_SELECTOR); | ||
assert | ||
.dom(screen.getByRole('button', { name: 'Editer le candidat Loulou Duck' })) | ||
.dom(screen.getByRole('button', { name: 'Editer le candidat Jean Registre' })) | ||
.hasClass(EDIT_BUTTON_SELECTOR); | ||
assert.strictEqual( | ||
screen.getAllByText("Ce candidat a déjà rejoint la session. Vous ne pouvez pas l'éditer.").length, | ||
|
@@ -363,7 +317,6 @@ module('Integration | Component | Sessions | SessionDetails | EnrolledCandidates | |
test('should display candidate needs accessibility adjusted certification', async function (assert) { | ||
// given | ||
const candidate = _buildCertificationCandidate({ | ||
birthdate: new Date('2019-04-28'), | ||
accessibilityAdjustmentNeeded: true, | ||
}); | ||
|
||
|
@@ -391,7 +344,6 @@ module('Integration | Component | Sessions | SessionDetails | EnrolledCandidates | |
test('should display candidate doesnt need accessibility adjusted certification', async function (assert) { | ||
// given | ||
const candidate = _buildCertificationCandidate({ | ||
birthdate: new Date('2019-04-28'), | ||
accessibilityAdjustmentNeeded: false, | ||
}); | ||
|
||
|
@@ -420,7 +372,6 @@ module('Integration | Component | Sessions | SessionDetails | EnrolledCandidates | |
test('should not display accessibility adjusted certification needed information', async function (assert) { | ||
// given | ||
const candidate = _buildCertificationCandidate({ | ||
birthdate: new Date('2019-04-28'), | ||
accessibilityAdjustmentNeeded: true, | ||
}); | ||
|
||
|
@@ -450,20 +401,8 @@ module('Integration | Component | Sessions | SessionDetails | EnrolledCandidates | |
test('it does not display candidates with an edit button', async function (assert) { | ||
// given | ||
const certificationCandidates = [ | ||
_buildCertificationCandidate({ | ||
id: 1, | ||
firstName: 'Riri', | ||
lastName: 'Duck', | ||
isLinked: false, | ||
subscriptions: [], | ||
}), | ||
_buildCertificationCandidate({ | ||
id: 2, | ||
firstName: 'Fifi', | ||
lastName: 'Duck', | ||
isLinked: true, | ||
subscriptions: [], | ||
}), | ||
_buildCertificationCandidate({ id: '1' }), | ||
_buildCertificationCandidate({ id: '2', firstName: 'Lara', lastName: 'Pafromage', isLinked: true }), | ||
].map((candidateData) => store.createRecord('certification-candidate', candidateData)); | ||
const countries = [store.createRecord('country', { name: 'CANADA', code: 99401 })]; | ||
|
||
|
@@ -479,8 +418,8 @@ module('Integration | Component | Sessions | SessionDetails | EnrolledCandidates | |
); | ||
|
||
// then | ||
assert.dom(screen.queryByRole('button', { name: 'Editer le candidat Riri Duck' })).doesNotExist(); | ||
assert.dom(screen.queryByRole('button', { name: 'Editer le candidat Fifi Duck' })).doesNotExist(); | ||
assert.dom(screen.queryByRole('button', { name: 'Editer le candidat Eddy Taurial' })).doesNotExist(); | ||
assert.dom(screen.queryByRole('button', { name: 'Editer le candidat Lara Pafromage' })).doesNotExist(); | ||
}); | ||
}); | ||
}); | ||
|
@@ -498,7 +437,6 @@ module('Integration | Component | Sessions | SessionDetails | EnrolledCandidates | |
complementaryCertificationId: cleaCertificationId, | ||
}); | ||
const candidate = _buildCertificationCandidate({ | ||
birthdate: new Date('2019-04-28'), | ||
subscriptions: [coreSubscription, complementarySubscription], | ||
}); | ||
const complementaryCertifications = [ | ||
|
@@ -728,18 +666,18 @@ module('Integration | Component | Sessions | SessionDetails | EnrolledCandidates | |
|
||
function _buildCertificationCandidate({ | ||
id = '12345', | ||
firstName = 'Bob', | ||
lastName = 'Leponge', | ||
birthdate = new Date(), | ||
birthCity = 'Marseille', | ||
birthProvinceCode = '', | ||
birthCountry = '', | ||
email = '[email protected]', | ||
resultRecipientEmail = '[email protected]', | ||
firstName = 'Eddy', | ||
lastName = 'Taurial', | ||
birthdate = '1990-03-22', | ||
birthCity = 'Sainte-Anne', | ||
birthProvinceCode = '01', | ||
birthCountry = 'France', | ||
email = '[email protected]', | ||
resultRecipientEmail = '[email protected]', | ||
externalId = 'an external id', | ||
extraTimePercentage = 0.3, | ||
isLinked = false, | ||
billingMode = null, | ||
billingMode = 'FREE', | ||
prepaymentCode = null, | ||
accessibilityAdjustmentNeeded = false, | ||
subscriptions = [], | ||
|
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
un ptit test ? :)