-
Notifications
You must be signed in to change notification settings - Fork 38
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 #9491 from transcom/ruizaj-mb-14395-createBasicSer…
…vieItem-refactor [MB-14395] create basic service item refactor
- Loading branch information
Showing
4 changed files
with
35 additions
and
27 deletions.
There are no files selected for viewing
8 changes: 3 additions & 5 deletions
8
.../EventTemplates/createBasicServiceItem.js → ...askOrderStatus/createBasicServiceItem.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 |
---|---|---|
@@ -1,15 +1,13 @@ | ||
import React from 'react'; | ||
|
||
import a from 'constants/MoveHistory/Database/Actions'; | ||
import o from 'constants/MoveHistory/UIDisplay/Operations'; | ||
import d from 'constants/MoveHistory/UIDisplay/DetailsTypes'; | ||
import t from 'constants/MoveHistory/Database/Tables'; | ||
|
||
export default { | ||
action: a.INSERT, | ||
eventName: o.updateMoveTaskOrderStatus, | ||
tableName: t.mto_service_items, | ||
detailsType: d.PLAIN_TEXT, | ||
getEventNameDisplay: () => 'Approved service item', | ||
getDetailsPlainText: (historyRecord) => { | ||
return `${historyRecord.context[0]?.name}`; | ||
}, | ||
getDetails: ({ context }) => <> {context[0]?.name} </>, | ||
}; |
31 changes: 31 additions & 0 deletions
31
...ants/MoveHistory/EventTemplates/UpdateMoveTaskOrderStatus/createBasicServiceItem.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,31 @@ | ||
import { screen, render } from '@testing-library/react'; | ||
|
||
import getTemplate from 'constants/MoveHistory/TemplateManager'; | ||
import e from 'constants/MoveHistory/EventTemplates/UpdateMoveTaskOrderStatus/createBasicServiceItem'; | ||
|
||
describe('when given a Create basic service item history record', () => { | ||
const historyRecord = { | ||
action: 'INSERT', | ||
context: [ | ||
{ | ||
name: 'Move management', | ||
}, | ||
], | ||
eventName: 'updateMoveTaskOrderStatus', | ||
tableName: 'mto_service_items', | ||
}; | ||
|
||
it('correctly matches the Create basic service item template', () => { | ||
const template = getTemplate(historyRecord); | ||
|
||
expect(template).toMatchObject(e); | ||
expect(template.getEventNameDisplay(template)).toEqual('Approved service item'); | ||
}); | ||
|
||
it('displays the expected details column value', () => { | ||
const template = getTemplate(historyRecord); | ||
|
||
render(template.getDetails(historyRecord)); | ||
expect(screen.getByText('Move management')).toBeInTheDocument(); | ||
}); | ||
}); |
21 changes: 0 additions & 21 deletions
21
src/constants/MoveHistory/EventTemplates/createBasicServiceItem.test.js
This file was deleted.
Oops, something went wrong.
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