-
Notifications
You must be signed in to change notification settings - Fork 14
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
#2180 - Assessment Workflow Enqueuer Scheduler - Start Assessment - E2E tests #2314
#2180 - Assessment Workflow Enqueuer Scheduler - Start Assessment - E2E tests #2314
Conversation
Kudos, SonarCloud Quality Gate passed!
|
...rc/processors/schedulers/workflow/_tests_/assessment-workflow-enqueuer.scheduler.e2e-spec.ts
Show resolved
Hide resolved
// Arrange | ||
|
||
// Application submitted with original assessment. | ||
const application = await createDefaultApplication(); |
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.
Trying to understand the purpose of the new method? won't it be able to achieve by saveFakeApplicationDisbursements
?
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.
It is just a centralization inside the same TC file. There are positive and negative scenarios using the same method which makes it better to assume that, when there is a negative test it would be more accurate because the positive is already using the same method.
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.
These test cases are also targeting student assessments, not disbursements. Can you please point out the benefit of using the saveFakeApplicationDisbursements
?
@andrepestana-aot FYI
* the provided student assessment. | ||
*/ | ||
const createDefaultApplication = async ( | ||
assessmentStatus?: StudentAssessmentStatus, |
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.
options?:
with partial<>
?
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.
This is a simple helper method inside a TC file itself and not a shared factory. Should we follow the above-mentioned suggestion for such method?
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.
I don't have a strong feeling, I am good with both, unless the options are big
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.
It is a local method and it is not intended to be shared and the comments state its purpose.
If there is not a strong feeling I will keep the method as it is and state again, I never saw a reason for local methods to follow the patterns used on factories, options yes, we use it all around, "options?: with partial<>" is something to be enforced from factories. Hope that it is ok.
application, | ||
auditUser, | ||
}); | ||
oldestAssessment.triggerType = AssessmentTriggerType.OfferingChange; |
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.
👍
[ | ||
StudentAssessmentStatus.Queued, | ||
StudentAssessmentStatus.InProgress, | ||
].forEach((status) => { |
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.
nice
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.
LGTM @andrewsignori-aot 👍 just a minor comment and a question
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.
Looks good but I agree with Ann on #2314 (review)
Please take a look. Thanks.
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.
LGTM, nice work @andrewsignori-aot
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.
Nice work @andrewsignori-aot 👍
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.
Looks good.
[ | ||
StudentAssessmentStatus.Queued, | ||
StudentAssessmentStatus.InProgress, | ||
].forEach((status) => { |
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.
👍
|
||
// Application submitted with original assessment. | ||
const application = await createDefaultApplication(status); | ||
const submittedAssessment = createFakeStudentAssessment({ |
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.
Should we not update application.currentAssessment = submittedAssessment
?
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.
That operation happens inside the factory already used in the method createDefaultApplication
.
}); | ||
}); | ||
|
||
it(`Should not queue a '${StudentAssessmentStatus.Submitted}' assessment if currentAssessment and currentProcessingAssessment are the same already.`, async () => { |
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.
I am wondering how currentAssessment and currentProcessing assessment could be same when assessment status is submitted?
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.
In the real world, they would not have it. This condition is to force the specific SQL condition. That is what the below comment is stating.
"// Force currentAssessment and currentProcessingAssessment to be the same to test the SQL condition."
Great work. One clarification and one minor question. |
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.
Nice Work @andrewsignori-aot 👍
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.
Looks good 👍
Create a few E2E tests for the new schedler.
Created a method to centralize the mock name creation and allow retrieve the mock to execute tests like
toBeCalledWith
.