Skip to content

Commit

Permalink
Merge pull request #1427 from bcgov/feature/ALCS-1678
Browse files Browse the repository at this point in the history
Only send email if it matches the current status
  • Loading branch information
dhaselhan authored Feb 15, 2024
2 parents 9ea1ea5 + 772a886 commit d5be9a7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,16 @@ describe('ApplicationSubmissionStatusEmailConsumer', () => {
});

it('should send email and update submissionToStatus entry of IN_REVIEW_BY_ALC status', async () => {
const mockSubmission = new ApplicationSubmission({ fileNumber: 'fake' });
const mockSubmission = new ApplicationSubmission({
fileNumber: 'fake',
submissionStatuses: [
new ApplicationSubmissionToSubmissionStatus({
statusTypeCode: SUBMISSION_STATUS.IN_REVIEW_BY_ALC,
effectiveDate: new Date(),
}),
],
});
mockSubmission.populateCurrentStatus();
const mockPrimaryContact = new ApplicationOwner();
const mockLocalGovernment = new LocalGovernment();

Expand Down Expand Up @@ -97,7 +106,16 @@ describe('ApplicationSubmissionStatusEmailConsumer', () => {
});

it('should send email and update submissionToStatus entry of ALC_DECISION status', async () => {
const mockSubmission = new ApplicationSubmission({ fileNumber: 'fake' });
const mockSubmission = new ApplicationSubmission({
fileNumber: 'fake',
submissionStatuses: [
new ApplicationSubmissionToSubmissionStatus({
statusTypeCode: SUBMISSION_STATUS.ALC_DECISION,
effectiveDate: new Date(),
}),
],
});
mockSubmission.populateCurrentStatus();
const mockPrimaryContact = new ApplicationOwner();
const mockLocalGovernment = new LocalGovernment();
const mockDocuments = [{ name: 'fake-document', url: 'fake-url' }];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,8 @@ export class ApplicationSubmissionStatusEmailConsumer extends WorkerHost {
) {
if (
primaryContact &&
[
SUBMISSION_STATUS.IN_REVIEW_BY_ALC,
SUBMISSION_STATUS.ALC_DECISION,
].includes(<SUBMISSION_STATUS>submissionStatus.statusTypeCode)
applicationSubmission.status.statusTypeCode ===
submissionStatus.statusTypeCode
) {
const generateStatusHtml =
submissionStatus.statusTypeCode === SUBMISSION_STATUS.ALC_DECISION
Expand Down

0 comments on commit d5be9a7

Please sign in to comment.