-
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 pull request #14535 from transcom/B-20536-MAIN
B-20536 add queue management tracking to move history
- Loading branch information
Showing
20 changed files
with
436 additions
and
5 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
18 changes: 18 additions & 0 deletions
18
src/constants/MoveHistory/EventTemplates/FinishDocumentReview/FinishDocumentReviewMoves.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,18 @@ | ||
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'; | ||
|
||
export default { | ||
action: a.UPDATE, | ||
eventName: o.finishDocumentReview, | ||
tableName: t.moves, | ||
getEventNameDisplay: () => 'Updated move', | ||
getDetails: ({ changedValues }) => ( | ||
<> | ||
<div>PPM Closeout Complete</div> | ||
{changedValues?.sc_assigned_id !== undefined ? <div>Closeout Counselor Unassigned</div> : null} | ||
</> | ||
), | ||
}; |
43 changes: 43 additions & 0 deletions
43
...stants/MoveHistory/EventTemplates/FinishDocumentReview/FinishDocumentReviewMoves.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,43 @@ | ||
import { screen, render } from '@testing-library/react'; | ||
|
||
import e from 'constants/MoveHistory/EventTemplates/FinishDocumentReview/FinishDocumentReviewMoves'; | ||
import getTemplate from 'constants/MoveHistory/TemplateManager'; | ||
|
||
describe('When given a completed services counseling for a move', () => { | ||
const historyRecord = { | ||
action: 'UPDATE', | ||
eventName: 'finishDocumentReview', | ||
tableName: 'moves', | ||
}; | ||
it('correctly matches the update mto status services counseling completed event to the proper template', () => { | ||
const template = getTemplate(historyRecord); | ||
expect(template).toMatchObject(e); | ||
}); | ||
|
||
it('displays the proper name in the event name display column', () => { | ||
const template = getTemplate(historyRecord); | ||
|
||
render(template.getEventNameDisplay(historyRecord)); | ||
expect(screen.getByText('Updated move')).toBeInTheDocument(); | ||
}); | ||
|
||
it('displays default when SC ID is not present', () => { | ||
const template = getTemplate(historyRecord); | ||
|
||
render(template.getDetails(historyRecord)); | ||
expect(screen.getByText('PPM Closeout Complete')).toBeInTheDocument(); | ||
expect(screen.queryByText('Closeout Counselor Unassigned')).not.toBeInTheDocument(); | ||
}); | ||
|
||
it('displays correct details when a SC is unassigned', () => { | ||
historyRecord.changedValues = { | ||
...historyRecord.changedValues, | ||
sc_assigned_id: null, | ||
}; | ||
const template = getTemplate(historyRecord); | ||
|
||
render(template.getDetails(historyRecord)); | ||
expect(screen.getByText('PPM Closeout Complete')).toBeInTheDocument(); | ||
expect(screen.getByText('Closeout Counselor Unassigned')).toBeInTheDocument(); | ||
}); | ||
}); |
18 changes: 18 additions & 0 deletions
18
...onstants/MoveHistory/EventTemplates/UpdateAssignedOfficeUser/DeleteAssignedOfficeUser.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,18 @@ | ||
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'; | ||
|
||
export default { | ||
action: a.UPDATE, | ||
eventName: o.deleteAssignedOfficeUser, | ||
tableName: t.moves, | ||
getEventNameDisplay: () => 'Updated move', | ||
getDetails: ({ changedValues }) => { | ||
if (changedValues.sc_assigned_id === null) return <>Counselor unassigned</>; | ||
if (changedValues.too_assigned_id === null) return <>Task ordering officer unassigned</>; | ||
if (changedValues.tio_assigned_id === null) return <>Task invoicing officer unassigned</>; | ||
return <>Unassigned</>; | ||
}, | ||
}; |
50 changes: 50 additions & 0 deletions
50
...nts/MoveHistory/EventTemplates/UpdateAssignedOfficeUser/DeleteAssignedOfficeUser.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,50 @@ | ||
import { screen, render } from '@testing-library/react'; | ||
|
||
import e from 'constants/MoveHistory/EventTemplates/UpdateAssignedOfficeUser/DeleteAssignedOfficeUser'; | ||
import getTemplate from 'constants/MoveHistory/TemplateManager'; | ||
|
||
describe('When given a move that has been unassigned', () => { | ||
const historyRecord = { | ||
action: 'UPDATE', | ||
eventName: 'deleteAssignedOfficeUser', | ||
tableName: 'moves', | ||
changedValues: { | ||
sc_assigned_id: null, | ||
}, | ||
}; | ||
|
||
it('correctly matches the template', () => { | ||
const template = getTemplate(historyRecord); | ||
expect(template).toMatchObject(e); | ||
}); | ||
|
||
it('displays the proper name in the event name display column', () => { | ||
const template = getTemplate(historyRecord); | ||
|
||
render(template.getEventNameDisplay(historyRecord)); | ||
expect(screen.getByText('Updated move')).toBeInTheDocument(); | ||
}); | ||
|
||
describe('displays the proper details for', () => { | ||
it('services counselor', () => { | ||
const template = getTemplate(historyRecord); | ||
|
||
render(template.getDetails(historyRecord)); | ||
expect(screen.getByText('Counselor unassigned')).toBeInTheDocument(); | ||
}); | ||
it('task ordering officer', () => { | ||
historyRecord.changedValues = { too_assigned_id: null }; | ||
const template = getTemplate(historyRecord); | ||
|
||
render(template.getDetails(historyRecord)); | ||
expect(screen.getByText('Task ordering officer unassigned')).toBeInTheDocument(); | ||
}); | ||
it('task invoicing officer', () => { | ||
historyRecord.changedValues = { tio_assigned_id: null }; | ||
const template = getTemplate(historyRecord); | ||
|
||
render(template.getDetails(historyRecord)); | ||
expect(screen.getByText('Task invoicing officer unassigned')).toBeInTheDocument(); | ||
}); | ||
}); | ||
}); |
23 changes: 23 additions & 0 deletions
23
...onstants/MoveHistory/EventTemplates/UpdateAssignedOfficeUser/UpdateAssignedOfficeUser.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,23 @@ | ||
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'; | ||
import { formatAssignedOfficeUserFromContext } from 'utils/formatters'; | ||
|
||
const formatChangedValues = (historyRecord) => { | ||
const newChangedValues = { | ||
...formatAssignedOfficeUserFromContext(historyRecord), | ||
}; | ||
|
||
return { ...historyRecord, changedValues: newChangedValues }; | ||
}; | ||
|
||
export default { | ||
action: a.UPDATE, | ||
eventName: o.updateAssignedOfficeUser, | ||
tableName: t.moves, | ||
getEventNameDisplay: () => 'Updated move', | ||
getDetails: (historyRecord) => <LabeledDetails historyRecord={formatChangedValues(historyRecord)} />, | ||
}; |
65 changes: 65 additions & 0 deletions
65
...nts/MoveHistory/EventTemplates/UpdateAssignedOfficeUser/UpdateAssignedOfficeUser.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,65 @@ | ||
import { screen, render } from '@testing-library/react'; | ||
|
||
import e from 'constants/MoveHistory/EventTemplates/UpdateAssignedOfficeUser/UpdateAssignedOfficeUser'; | ||
import getTemplate from 'constants/MoveHistory/TemplateManager'; | ||
|
||
describe('When given a move that has been assigned', () => { | ||
const historyRecord = { | ||
action: 'UPDATE', | ||
eventName: 'updateAssignedOfficeUser', | ||
tableName: 'moves', | ||
changedValues: { | ||
sc_assigned_id: 'fb625e3c-067c-49d7-8fd9-88ef040e6137', | ||
}, | ||
oldValues: { | ||
sc_assigned_id: null, | ||
}, | ||
context: [{ assigned_office_user_last_name: 'Daniels', assigned_office_user_first_name: 'Jayden' }], | ||
}; | ||
|
||
it('correctly matches the template', () => { | ||
const template = getTemplate(historyRecord); | ||
expect(template).toMatchObject(e); | ||
}); | ||
|
||
it('displays the proper name in the event name display column', () => { | ||
const template = getTemplate(historyRecord); | ||
|
||
render(template.getEventNameDisplay(historyRecord)); | ||
expect(screen.getByText('Updated move')).toBeInTheDocument(); | ||
}); | ||
|
||
describe('displays the proper details for', () => { | ||
it('services counselor', () => { | ||
const template = getTemplate(historyRecord); | ||
|
||
render(template.getDetails(historyRecord)); | ||
expect(screen.getByText('Counselor assigned')).toBeInTheDocument(); | ||
expect(screen.getByText(': Daniels, Jayden')).toBeInTheDocument(); | ||
}); | ||
it('task ordering officer', () => { | ||
historyRecord.changedValues = { too_assigned_id: 'fb625e3c-067c-49d7-8fd9-88ef040e6137' }; | ||
historyRecord.oldValues = { too_assigned_id: null }; | ||
historyRecord.context = [ | ||
{ assigned_office_user_last_name: 'Robinson', assigned_office_user_first_name: 'Brian' }, | ||
]; | ||
|
||
const template = getTemplate(historyRecord); | ||
|
||
render(template.getDetails(historyRecord)); | ||
expect(screen.getByText('Task ordering officer assigned')).toBeInTheDocument(); | ||
expect(screen.getByText(': Robinson, Brian')).toBeInTheDocument(); | ||
}); | ||
it('task invoicing officer', () => { | ||
historyRecord.changedValues = { tio_assigned_id: 'fb625e3c-067c-49d7-8fd9-88ef040e6137' }; | ||
historyRecord.oldValues = { tio_assigned_id: null }; | ||
historyRecord.context = [{ assigned_office_user_last_name: 'Luvu', assigned_office_user_first_name: 'Frankie' }]; | ||
|
||
const template = getTemplate(historyRecord); | ||
|
||
render(template.getDetails(historyRecord)); | ||
expect(screen.getByText('Task invoicing officer assigned')).toBeInTheDocument(); | ||
expect(screen.getByText(': Luvu, Frankie')).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
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
18 changes: 18 additions & 0 deletions
18
...MoveHistory/EventTemplates/UpdatePaymentRequestStatus/UpdatePaymentRequestStatusMoves.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,18 @@ | ||
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'; | ||
|
||
export default { | ||
action: a.UPDATE, | ||
eventName: o.updatePaymentRequestStatus, | ||
tableName: t.moves, | ||
getEventNameDisplay: () => 'Updated move', | ||
getDetails: ({ changedValues }) => ( | ||
<> | ||
<div>Payment Requests Addressed</div> | ||
{changedValues?.tio_assigned_id !== undefined ? <div>Task Invoicing Officer Unassigned</div> : null} | ||
</> | ||
), | ||
}; |
42 changes: 42 additions & 0 deletions
42
...istory/EventTemplates/UpdatePaymentRequestStatus/UpdatePaymentRequestStatusMoves.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,42 @@ | ||
import { screen, render } from '@testing-library/react'; | ||
|
||
import e from 'constants/MoveHistory/EventTemplates/UpdatePaymentRequestStatus/UpdatePaymentRequestStatusMoves'; | ||
import getTemplate from 'constants/MoveHistory/TemplateManager'; | ||
|
||
describe('When given a completed services counseling for a move', () => { | ||
const historyRecord = { | ||
action: 'UPDATE', | ||
eventName: 'updatePaymentRequestStatus', | ||
tableName: 'moves', | ||
}; | ||
it('correctly matches the update mto status services counseling completed event to the proper template', () => { | ||
const template = getTemplate(historyRecord); | ||
expect(template).toMatchObject(e); | ||
}); | ||
|
||
it('displays the proper name in the event name display column', () => { | ||
const template = getTemplate(historyRecord); | ||
|
||
render(template.getEventNameDisplay(historyRecord)); | ||
expect(screen.getByText('Updated move')).toBeInTheDocument(); | ||
}); | ||
|
||
it('displays default when TIO ID is not present', () => { | ||
const template = getTemplate(historyRecord); | ||
|
||
render(template.getDetails(historyRecord)); | ||
expect(screen.getByText('Payment Requests Addressed')).toBeInTheDocument(); | ||
}); | ||
|
||
it('displays correct details when a TIO is unassigned', () => { | ||
historyRecord.changedValues = { | ||
...historyRecord.changedValues, | ||
tio_assigned_id: null, | ||
}; | ||
const template = getTemplate(historyRecord); | ||
|
||
render(template.getDetails(historyRecord)); | ||
expect(screen.getByText('Payment Requests Addressed')).toBeInTheDocument(); | ||
expect(screen.getByText('Task Invoicing Officer Unassigned')).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
Oops, something went wrong.