Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffsmohan committed Mar 1, 2024
1 parent b79081f commit ec4131a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/server/__tests__/email/email.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,21 @@ describe('Email sender', () => {
expect(body).to.include(name);
expect(body).to.include(moment(openDate).format('MMMM Do YYYY'));
});
it('links to Grants.gov when Grant Details page is not live', async () => {
const agencies = await db.getAgency(fixtures.agencies.accountancy.id);
const agency = agencies[0];
agency.matched_grants = [fixtures.grants.healthAide];
const body = await email.buildDigestBody({ name: 'Saved search test', openDate: '2021-08-05', matchedGrants: agency.matched_grants });
expect(body).to.include(`https://www.grants.gov/search-results-detail/${fixtures.grants.healthAide.grant_id}`.replaceAll('/', '/'));
});
it('links to Grant Finder when Grant Details page is live', async () => {
process.env.NEW_GRANT_DETAILS_PAGE_ENABLED = 'true';
const agencies = await db.getAgency(fixtures.agencies.accountancy.id);
const agency = agencies[0];
agency.matched_grants = [fixtures.grants.healthAide];
const body = await email.buildDigestBody({ name: 'Saved search test', openDate: '2021-08-05', matchedGrants: agency.matched_grants });
expect(body).to.include(`${process.env.WEBSITE_DOMAIN}/grant/${fixtures.grants.healthAide.grant_id}`.replaceAll('/', '/'));
});
});
context('getAndSendGrantForSavedSearch', () => {
it('Sends an email for a saved search', async () => {
Expand Down

0 comments on commit ec4131a

Please sign in to comment.