forked from ustaxcourt/ef-cms
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5599 from flexion/4611-submit-create-order
4611: submit order from message and add as attachment
- Loading branch information
Showing
8 changed files
with
180 additions
and
3 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
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const { get } = require('../../dynamodbClientService'); | ||
|
||
/** | ||
* getCaseMessage | ||
* | ||
* @param {object} providers the providers object | ||
* @param {object} providers.applicationContext the application context | ||
* @param {string} providers.caseId the id of the case | ||
* @param {string} providers.messageId the id of the message | ||
* @returns {object} the created case message | ||
*/ | ||
exports.getCaseMessage = async ({ applicationContext, caseId, messageId }) => { | ||
return await get({ | ||
Key: { | ||
pk: `case|${caseId}`, | ||
sk: `message|${messageId}`, | ||
}, | ||
applicationContext, | ||
}); | ||
}; |
37 changes: 37 additions & 0 deletions
37
shared/src/persistence/dynamo/messages/getCaseMessage.test.js
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
const { | ||
applicationContext, | ||
} = require('../../../business/test/createTestApplicationContext'); | ||
const { getCaseMessage } = require('./getCaseMessage'); | ||
|
||
const mockCaseMessage = { | ||
caseId: 'b3f09a45-b27c-4383-acc1-2ab1f99e6725', | ||
createdAt: '2019-03-01T21:40:46.415Z', | ||
from: 'Test Petitionsclerk', | ||
fromSection: 'petitions', | ||
fromUserId: '4791e892-14ee-4ab1-8468-0c942ec379d2', | ||
message: 'hey there', | ||
messageId: 'a10d6855-f3ee-4c11-861c-c7f11cba4dff', | ||
subject: 'hello', | ||
to: 'Test Petitionsclerk2', | ||
toSection: 'petitions', | ||
toUserId: '449b916e-3362-4a5d-bf56-b2b94ba29c12', | ||
}; | ||
|
||
describe('getCaseMessage', () => { | ||
beforeAll(() => { | ||
applicationContext.environment.stage = 'dev'; | ||
applicationContext.getDocumentClient().get.mockReturnValue({ | ||
promise: () => Promise.resolve({ Item: mockCaseMessage }), | ||
}); | ||
}); | ||
|
||
it('retrieves the case message from persistence', async () => { | ||
const retrievedMessage = await getCaseMessage({ | ||
applicationContext, | ||
caseId: mockCaseMessage.caseId, | ||
messageId: mockCaseMessage.messageId, | ||
}); | ||
|
||
expect(retrievedMessage).toEqual(mockCaseMessage); | ||
}); | ||
}); |
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