-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tag emails according to type and audience (#2959)
* Tag emails according to type and audience. * Fix fromName in tests. * Add more options to sendDebugEmail script. * Add comment.
- Loading branch information
Showing
21 changed files
with
388 additions
and
241 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,7 +44,7 @@ describe('audit report generation', () => { | |
expect(sendFake.calledOnce).to.equal(true); | ||
expect(sendFake.firstCall.args[0]).to.equal('[email protected]'); | ||
expect(sendFake.firstCall.args[1]).to.equal(`${process.env.API_DOMAIN}/api/audit_report/1/99/example.xlsx`); | ||
expect(sendFake.firstCall.args[2]).to.equal('audit'); | ||
expect(sendFake.firstCall.args[2]).to.equal(email.ASYNC_REPORT_TYPES.audit); | ||
}); | ||
it('generateAndSendEmail generates a report, uploads to s3, and sends an email', async () => { | ||
const sendFake = sandbox.fake.returns('foo'); | ||
|
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 |
---|---|---|
|
@@ -40,9 +40,11 @@ describe('db', () => { | |
'DRY RUN :: Begin migrating legacy agency criteria to saved searches', | ||
'DRY RUN :: Migrating agency criteria for agency 0', | ||
'DRY RUN :: No agency criteria to migrate for agency 1', | ||
'DRY RUN :: No agency criteria to migrate for agency 2', | ||
'DRY RUN :: Migrating agency criteria for agency 4', | ||
'DRY RUN :: Migrating agency criteria for users 1,2 belonging to agency 0', | ||
'DRY RUN :: No agency criteria to migrate for users 3 belonging to agency 1', | ||
'DRY RUN :: No agency criteria to migrate for users 4 belonging to agency 2', | ||
'DRY RUN :: No users to migrate for agency 4', | ||
'DRY RUN :: Would have inserted approximately 2 saved searches. Note: there may be duplicates.', | ||
'DRY RUN :: Done migrating legacy agency criteria to saved searches', | ||
|
@@ -64,9 +66,11 @@ describe('db', () => { | |
'Begin migrating legacy agency criteria to saved searches', | ||
'Migrating agency criteria for agency 0', | ||
'No agency criteria to migrate for agency 1', | ||
'No agency criteria to migrate for agency 2', | ||
'Migrating agency criteria for agency 4', | ||
'Migrating agency criteria for users 1,2 belonging to agency 0', | ||
'No agency criteria to migrate for users 3 belonging to agency 1', | ||
'No agency criteria to migrate for users 4 belonging to agency 2', | ||
'No users to migrate for agency 4', | ||
'Inserted 2 saved searches', | ||
'Done migrating legacy agency criteria to saved searches', | ||
|
@@ -109,9 +113,11 @@ describe('db', () => { | |
'Begin migrating legacy agency criteria to saved searches', | ||
'Migrating agency criteria for agency 0', | ||
'No agency criteria to migrate for agency 1', | ||
'No agency criteria to migrate for agency 2', | ||
'Migrating agency criteria for agency 4', | ||
'Migrating agency criteria for users 1,2 belonging to agency 0', | ||
'No agency criteria to migrate for users 3 belonging to agency 1', | ||
'No agency criteria to migrate for users 4 belonging to agency 2', | ||
'No users to migrate for agency 4', | ||
'Inserted 1 saved searches', // This would have been 2 if not for the duplication mechanism. | ||
'Done migrating legacy agency criteria to saved searches', | ||
|
@@ -797,6 +803,17 @@ describe('db', () => { | |
}); | ||
}); | ||
|
||
context('getUserIdForEmail', () => { | ||
it('returns id when user exists', async () => { | ||
const result = await db.getUserIdForEmail(fixtures.users.adminUser.email); | ||
expect(result).to.equal(fixtures.users.adminUser.id); | ||
}); | ||
it('returns null when user does not exist', async () => { | ||
const result = await db.getUserIdForEmail('[email protected]'); | ||
expect(result).to.be.null; | ||
}); | ||
}); | ||
|
||
context('getNewGrantsForAgency', () => { | ||
beforeEach(() => { | ||
this.clockFn = (date) => sinon.useFakeTimers(new Date(date)); | ||
|
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 |
---|---|---|
|
@@ -11,8 +11,12 @@ const tenants = { | |
id: 0, | ||
display_name: 'SBA', | ||
}, | ||
FS: { | ||
USDR: { | ||
id: 1, | ||
display_name: 'USDR', | ||
}, | ||
FS: { | ||
id: 2, | ||
display_name: 'FS', | ||
}, | ||
}; | ||
|
@@ -34,6 +38,14 @@ const agencies = { | |
parent: 0, | ||
tenant_id: tenants.SBA.id, | ||
}, | ||
usdr: { | ||
id: 2, | ||
abbreviation: 'USDR', | ||
code: 'USDR', | ||
name: 'United States Digital Response', | ||
parent: null, | ||
tenant_id: tenants.USDR.id, | ||
}, | ||
fleetServices: { | ||
id: 4, | ||
abbreviation: 'FSD', | ||
|
@@ -69,6 +81,14 @@ const users = { | |
id: 3, | ||
tenant_id: agencies.subAccountancy.tenant_id, | ||
}, | ||
usdrUser: { | ||
email: '[email protected]', | ||
name: 'USDR user', | ||
agency_id: agencies.usdr.id, | ||
role_id: roles.staffRole.id, | ||
id: 4, | ||
tenant_id: agencies.usdr.tenant_id, | ||
}, | ||
}; | ||
|
||
const keywords = { | ||
|
Oops, something went wrong.