Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
masimons committed Sep 30, 2024
1 parent 88ba9d1 commit 9ee9c24
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
15 changes: 2 additions & 13 deletions packages/server/__tests__/db/db.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,12 +363,12 @@ describe('db', () => {
expect(result).to.be.null;
});
it('shows forecasted grants', async () => {
grantId = '444819'
const grantId = '444819';
const result = await db.getSingleGrantDetails({ grantId, tenantId: fixtures.users.staffUser.tenant_id, showForecastedGrants: true });
expect(result.grant_id).to.eq('444819');
});
it('hides forecasted grants', async () => {
grantId = '444819'
const grantId = '444819';
const result = await db.getSingleGrantDetails({ grantId, tenantId: fixtures.users.staffUser.tenant_id, showForecastedGrants: false });
expect(result).to.be.null;
});
Expand Down Expand Up @@ -827,17 +827,6 @@ describe('db', () => {
const result = await db.getNewGrantsForAgency(fixtures.agencies.accountancy);
expect(result.length).to.equal(1);
});
it('does not return forecasted grants', async () => {
// marissa
const newGrant = fixtures.grants.healthAide;
newGrant.grant_id = '444817';
newGrant.open_date = new Date('2022-06-21');
newGrant.opportunity_status = 'forecasted';
await knex(TABLES.grants).insert(Object.values([newGrant]));
const result = await db.getNewGrantsForAgency(fixtures.agencies.accountancy);
const forecastedGrant = result.filter((grant) => grant.grant_id === '444817');
expect(forecastedGrant.length).to.equal(0);
});
});

context('createUser', () => {
Expand Down
3 changes: 1 addition & 2 deletions packages/server/src/db/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,7 @@ async function getNewGrantsForAgency(agency) {
.select(knex.raw(`${TABLES.grants}.*, count(*) OVER() AS total_grants`))
.modify(helpers.whereAgencyCriteriaMatch, agencyCriteria)
.modify((qb) => {
qb.where({ open_date: moment().subtract(1, 'day').format('YYYY-MM-DD') })
.whereNot({ opportunity_status: 'forecasted' });
qb.where({ open_date: moment().subtract(1, 'day').format('YYYY-MM-DD') });
})
.limit(3);

Expand Down

0 comments on commit 9ee9c24

Please sign in to comment.