Skip to content

Commit

Permalink
Update activity report count in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jasalisbury committed Mar 12, 2021
1 parent 1b97f23 commit 2c6e28b
Showing 1 changed file with 11 additions and 19 deletions.
30 changes: 11 additions & 19 deletions src/services/activityReports.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ const mockUser = {
hsesUserId: '1000',
};

const mockUserTwo = {
id: 1002,
homeRegionId: 1,
name: 'a user',
hsesUserId: 50,
hsesUsername: 'Rex',
};

const reportObject = {
activityRecipientType: 'grantee',
status: REPORT_STATUSES.DRAFT,
Expand Down Expand Up @@ -73,7 +81,7 @@ describe('Activity Reports DB service', () => {
await NextStep.destroy({ where: {} });
await ActivityRecipient.destroy({ where: {} });
await ActivityReport.destroy({ where: {} });
await User.destroy({ where: { id: mockUser.id } });
await User.destroy({ where: { id: [mockUser.id, mockUserTwo.id] } });
await NonGrantee.destroy({ where: { id: RECIPIENT_ID } });
await Grant.destroy({ where: { id: [RECIPIENT_ID, GRANTEE_ID] } });
await Grantee.destroy({ where: { id: [RECIPIENT_ID, GRANTEE_ID] } });
Expand Down Expand Up @@ -296,14 +304,6 @@ describe('Activity Reports DB service', () => {
let latestReport;
let firstGrant;

const mockUserTwo = {
id: 1002,
homeRegionId: 1,
name: 'a user',
hsesUsername: 'user',
hsesUserId: '1002',
};

beforeAll(async () => {
const topicsOne = ['topic d', 'topic c'];
const topicsTwo = ['topic b', 'topic a'];
Expand Down Expand Up @@ -412,14 +412,6 @@ describe('Activity Reports DB service', () => {
});

it('retrieves myalerts', async () => {
const mockUserTwo = {
id: 1002,
homeRegionId: 1,
name: 'a user',
hsesUserId: 50,
hsesUsername: 'Rex',
};

await User.findOrCreate({
where: {
id: mockUserTwo.id,
Expand All @@ -430,8 +422,8 @@ describe('Activity Reports DB service', () => {
await ActivityReport.create(reportObject);

const { count, rows } = await activityReportAlerts(mockUserTwo.id, {});
expect(count).toBe(7);
expect(rows.length).toBe(7);
expect(count).toBe(5);
expect(rows.length).toBe(5);
expect(rows[0].userId).toBe(mockUserTwo.id);
});
});
Expand Down

0 comments on commit 2c6e28b

Please sign in to comment.