Skip to content

Commit

Permalink
fix: mock aws
Browse files Browse the repository at this point in the history
  • Loading branch information
as1729 committed Oct 24, 2024
1 parent 09fa8a7 commit 77b8151
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
8 changes: 4 additions & 4 deletions api/src/services/subrecipients/subrecipients.scenarios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ export const standard = defineScenario<
endDate: '2024-09-30T00:00:00.000Z',
inputTemplate: {
create: {
name: 'String',
version: 'String',
name: 'Q3 - input',
version: '2024_q3',
effectiveDate: '2024-01-26T15:11:27.688Z',
},
},
outputTemplate: {
create: {
name: 'String',
version: 'String',
name: 'Q3 - output',
version: '2024_q3',
effectiveDate: '2024-01-26T15:11:27.688Z',
},
},
Expand Down
8 changes: 7 additions & 1 deletion api/src/services/subrecipients/subrecipients.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import type { GraphQLResolveInfo } from 'graphql'

import type { RedwoodGraphQLContext } from '@redwoodjs/graphql-server'

import { sendPutObjectToS3Bucket } from 'src/lib/aws'

import {
subrecipients,
subrecipient,
Expand All @@ -19,7 +21,10 @@ import type { StandardScenario } from './subrecipients.scenarios'
// Please refer to the RedwoodJS Testing Docs:
// https://redwoodjs.com/docs/testing#testing-services
// https://redwoodjs.com/docs/testing#jest-expect-type-considerations

jest.mock('src/lib/aws', () => ({
...jest.requireActual('src/lib/aws'),
sendPutObjectToS3Bucket: jest.fn(),
}))
describe('subrecipients', () => {
scenario('returns all subrecipients', async (scenario: StandardScenario) => {
mockCurrentUser(scenario.user.one)
Expand Down Expand Up @@ -134,6 +139,7 @@ describe('subrecipients', () => {
reportingPeriodId: scenario.reportingPeriod.q3.id,
},
})
expect(sendPutObjectToS3Bucket).toHaveBeenCalled()
expect(result.message).toEqual('Subrecipients uploaded successfully')
expect(result.success).toBe(true)
expect(result.countSubrecipients).toBe(1)
Expand Down

0 comments on commit 77b8151

Please sign in to comment.