-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'integrationTesting' into 20621-Add-Mobile-Shipment-Cust…
…omer-Flows-INT
- Loading branch information
Showing
6 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
src/constants/MoveHistory/EventTemplates/UpdateMTOShipment/patchMTOShipment.jsx
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,29 @@ | ||
import React from 'react'; | ||
|
||
import o from 'constants/MoveHistory/UIDisplay/Operations'; | ||
import a from 'constants/MoveHistory/Database/Actions'; | ||
import t from 'constants/MoveHistory/Database/Tables'; | ||
import LabeledDetails from 'pages/Office/MoveHistory/LabeledDetails'; | ||
|
||
const formatChangedValues = (historyRecord) => { | ||
let newChangedValues = { | ||
...historyRecord.changedValues, | ||
}; | ||
|
||
if (historyRecord.context) { | ||
newChangedValues = { | ||
...newChangedValues, | ||
...historyRecord.context[0], | ||
}; | ||
} | ||
|
||
return { ...historyRecord, changedValues: newChangedValues }; | ||
}; | ||
|
||
export default { | ||
action: a.UPDATE, | ||
eventName: o.patchMove, | ||
tableName: t.moves, | ||
getEventNameDisplay: () => 'Updated move', | ||
getDetails: (historyRecord) => <LabeledDetails historyRecord={formatChangedValues(historyRecord)} />, | ||
}; |
25 changes: 25 additions & 0 deletions
25
src/constants/MoveHistory/EventTemplates/UpdateMTOShipment/patchMTOShipment.test.jsx
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,25 @@ | ||
import { render, screen } from '@testing-library/react'; | ||
|
||
import getTemplate from 'constants/MoveHistory/TemplateManager'; | ||
import e from 'constants/MoveHistory/EventTemplates/UpdateMTOShipment/patchMTOShipment'; | ||
|
||
describe('when given a patch move record', () => { | ||
const historyRecord = { | ||
action: 'UPDATE', | ||
eventName: 'patchMove', | ||
tableName: 'moves', | ||
changedValues: { closeout_office_name: 'PPPO Scott AFB - USAF' }, | ||
}; | ||
|
||
it('correctly matches the patch move event', () => { | ||
const template = getTemplate(historyRecord); | ||
expect(template).toMatchObject(e); | ||
}); | ||
|
||
it('displays the proper update order record', () => { | ||
const template = getTemplate(historyRecord); | ||
render(template.getDetails(historyRecord)); | ||
expect(screen.getByText('Closeout office')).toBeInTheDocument(); | ||
expect(screen.getByText(': PPPO Scott AFB - USAF')).toBeInTheDocument(); | ||
}); | ||
}); |
13 changes: 13 additions & 0 deletions
13
...stants/MoveHistory/EventTemplates/UploadAdditionalDocuments/uploadAdditionalDocuments.jsx
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,13 @@ | ||
import React from 'react'; | ||
|
||
import a from 'constants/MoveHistory/Database/Actions'; | ||
import t from 'constants/MoveHistory/Database/Tables'; | ||
import o from 'constants/MoveHistory/UIDisplay/Operations'; | ||
|
||
export default { | ||
action: a.UPDATE, | ||
eventName: o.uploadAdditionalDocuments, | ||
tableName: t.moves, | ||
getEventNameDisplay: () => 'Updated move', | ||
getDetails: () => <>Uploaded additional document</>, | ||
}; |
17 changes: 17 additions & 0 deletions
17
...s/MoveHistory/EventTemplates/UploadAdditionalDocuments/uploadAdditionalDocuments.test.jsx
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,17 @@ | ||
import { render, screen } from '@testing-library/react'; | ||
|
||
import getTemplate from 'constants/MoveHistory/TemplateManager'; | ||
|
||
describe('when customer uploads additional documents', () => { | ||
const historyRecord = { | ||
action: 'UPDATE', | ||
eventName: 'uploadAdditionalDocuments', | ||
tableName: 'moves', | ||
}; | ||
it('correctly matches the Upload additional documents event', () => { | ||
const template = getTemplate(historyRecord); | ||
|
||
render(template.getDetails(historyRecord)); | ||
expect(screen.getByText('Uploaded additional document')).toBeInTheDocument(); | ||
}); | ||
}); |
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