Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(rhsmServices): ent-3352 api response props, mock and tests #786

Merged
merged 1 commit into from
Sep 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion public/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,10 @@
"header_sockets_OpenShift-metrics": "Sockets",
"header_sockets_OpenShift-dedicated-metrics": "Sockets",
"header_lastSeen": "Last seen",
"header_nextEventDate": "Next renewal",
"header_productName": "Product",
"header_quantity": "Quantity",
"header_serviceLevel": "Service level",
"header_upcomingEventDate": "Next renewal",
"measurementType": "{{context}}",
"measurementType_cloud": "Public cloud",
"measurementType_alibaba": "Public cloud",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Array [
"viewId": "lorem",
},
Object {
"sort": "product_name",
"sort": "next_event_date",
"type": "SET_QUERY_RHSM_SUBSCRIPTIONS_INVENTORY_sort",
"viewId": "lorem",
},
Expand All @@ -85,7 +85,7 @@ Array [
"viewId": "lorem",
},
Object {
"sort": "product_name",
"sort": "next_event_date",
"type": "SET_QUERY_RHSM_SUBSCRIPTIONS_INVENTORY_sort",
"viewId": "lorem",
},
Expand All @@ -99,7 +99,7 @@ Array [
"viewId": "lorem",
},
Object {
"sort": "product_name",
"sort": "next_event_date",
"type": "SET_QUERY_RHSM_SUBSCRIPTIONS_INVENTORY_sort",
"viewId": "lorem",
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ describe('InventorySubscriptions Component', () => {
const component = shallow(<InventorySubscriptions {...props} />);
const componentInstance = component.instance();

componentInstance.onColumnSort({}, { direction: SortByDirection.asc, id: 'productName' });
componentInstance.onColumnSort({}, { direction: SortByDirection.desc, id: 'productName' });
componentInstance.onColumnSort({}, { direction: SortByDirection.asc, id: 'nextEventDate' });
componentInstance.onColumnSort({}, { direction: SortByDirection.desc, id: 'nextEventDate' });
componentInstance.onColumnSort({}, { direction: SortByDirection.asc, id: 'loremIpsumBrokenOnPurpose' });
componentInstance.onColumnSort({}, { direction: SortByDirection.asc, id: 'productName' });
componentInstance.onColumnSort({}, { direction: SortByDirection.asc, id: 'nextEventDate' });

expect(mockDispatch.mock.calls).toMatchSnapshot('dispatch filter');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ exports[`ProductViewOpenShiftContainer Component should render a non-connected c
Object {
"cell": [Function],
"cellWidth": 15,
"id": "upcomingEventDate",
"id": "nextEventDate",
"isSortable": true,
"isWrappable": true,
},
Expand All @@ -254,7 +254,7 @@ exports[`ProductViewOpenShiftContainer Component should render a non-connected c
"ending": "2019-07-20T23:59:59.999Z",
"limit": 100,
"offset": 0,
"sort": "upcoming_event_date",
"sort": "next_event_date",
"uom": "cores",
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ Object {
Object {
"cell": [Function],
"cellWidth": 15,
"id": "upcomingEventDate",
"id": "nextEventDate",
"isSortable": true,
"isWrappable": true,
},
Expand All @@ -147,7 +147,7 @@ Object {
"dir": "desc",
"limit": 100,
"offset": 0,
"sort": "upcoming_event_date",
"sort": "next_event_date",
},
"productContextFilterUom": true,
"productGroup": "OpenShift Container Platform",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,13 +296,17 @@ Object {
],
},
Object {
"title": "t(curiosity-inventory.header, {\\"context\\":\\"upcomingEventDate\\"})",
"title": "t(curiosity-inventory.header, {\\"context\\":\\"nextEventDate\\"})",
"transforms": Array [
[Function],
],
},
],
"data": Object {
"nextEventDate": Object {
"title": "t(curiosity-inventory.header, {\\"context\\":\\"nextEventDate\\"})",
"value": "lorem date obj",
},
"productName": Object {
"title": "t(curiosity-inventory.header, {\\"context\\":\\"productName\\"})",
"value": "lorem",
Expand All @@ -311,10 +315,6 @@ Object {
"title": "t(curiosity-inventory.header, {\\"context\\":\\"serviceLevel\\"})",
"value": "hello world",
},
"upcomingEventDate": Object {
"title": "t(curiosity-inventory.header, {\\"context\\":\\"upcomingEventDate\\"})",
"value": "lorem date obj",
},
},
}
`;
Expand Down Expand Up @@ -342,13 +342,17 @@ Object {
],
},
Object {
"title": "t(curiosity-inventory.header, {\\"context\\":\\"upcomingEventDate\\"})",
"title": "t(curiosity-inventory.header, {\\"context\\":\\"nextEventDate\\"})",
"transforms": Array [
[Function],
],
},
],
"data": Object {
"nextEventDate": Object {
"title": "t(curiosity-inventory.header, {\\"context\\":\\"nextEventDate\\"})",
"value": null,
},
"productName": Object {
"title": "t(curiosity-inventory.header, {\\"context\\":\\"productName\\"})",
"value": "lorem",
Expand All @@ -357,10 +361,6 @@ Object {
"title": "t(curiosity-inventory.header, {\\"context\\":\\"serviceLevel\\"})",
"value": null,
},
"upcomingEventDate": Object {
"title": "t(curiosity-inventory.header, {\\"context\\":\\"upcomingEventDate\\"})",
"value": null,
},
},
}
`;
20 changes: 10 additions & 10 deletions src/config/__tests__/__snapshots__/product.rhel.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -328,13 +328,17 @@ Object {
],
},
Object {
"title": "t(curiosity-inventory.header, {\\"context\\":\\"upcomingEventDate\\"})",
"title": "t(curiosity-inventory.header, {\\"context\\":\\"nextEventDate\\"})",
"transforms": Array [
[Function],
],
},
],
"data": Object {
"nextEventDate": Object {
"title": "t(curiosity-inventory.header, {\\"context\\":\\"nextEventDate\\"})",
"value": "lorem date obj",
},
"productName": Object {
"title": "t(curiosity-inventory.header, {\\"context\\":\\"productName\\"})",
"value": "lorem",
Expand All @@ -343,10 +347,6 @@ Object {
"title": "t(curiosity-inventory.header, {\\"context\\":\\"serviceLevel\\"})",
"value": "hello world",
},
"upcomingEventDate": Object {
"title": "t(curiosity-inventory.header, {\\"context\\":\\"upcomingEventDate\\"})",
"value": "lorem date obj",
},
},
}
`;
Expand Down Expand Up @@ -374,13 +374,17 @@ Object {
],
},
Object {
"title": "t(curiosity-inventory.header, {\\"context\\":\\"upcomingEventDate\\"})",
"title": "t(curiosity-inventory.header, {\\"context\\":\\"nextEventDate\\"})",
"transforms": Array [
[Function],
],
},
],
"data": Object {
"nextEventDate": Object {
"title": "t(curiosity-inventory.header, {\\"context\\":\\"nextEventDate\\"})",
"value": null,
},
"productName": Object {
"title": "t(curiosity-inventory.header, {\\"context\\":\\"productName\\"})",
"value": "lorem",
Expand All @@ -389,10 +393,6 @@ Object {
"title": "t(curiosity-inventory.header, {\\"context\\":\\"serviceLevel\\"})",
"value": null,
},
"upcomingEventDate": Object {
"title": "t(curiosity-inventory.header, {\\"context\\":\\"upcomingEventDate\\"})",
"value": null,
},
},
}
`;
4 changes: 2 additions & 2 deletions src/config/__tests__/product.openshiftContainer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe('Product OpenShift Container config', () => {
const inventoryData = {
productName: 'lorem',
serviceLevel: 'hello world',
upcomingEventDate: 'lorem date obj'
nextEventDate: 'lorem date obj'
};

const filteredInventoryData = parseRowCellsListData({
Expand All @@ -67,7 +67,7 @@ describe('Product OpenShift Container config', () => {
const fallbackInventoryData = {
...inventoryData,
serviceLevel: null,
upcomingEventDate: null
nextEventDate: null
};

const fallbackFilteredInventoryData = parseRowCellsListData({
Expand Down
4 changes: 2 additions & 2 deletions src/config/__tests__/product.rhel.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe('Product RHEL config', () => {
const inventoryData = {
productName: 'lorem',
serviceLevel: 'hello world',
upcomingEventDate: 'lorem date obj'
nextEventDate: 'lorem date obj'
};

const filteredInventoryData = parseRowCellsListData({
Expand All @@ -67,7 +67,7 @@ describe('Product RHEL config', () => {
const fallbackInventoryData = {
...inventoryData,
serviceLevel: null,
upcomingEventDate: null
nextEventDate: null
};

const fallbackFilteredInventoryData = parseRowCellsListData({
Expand Down
10 changes: 5 additions & 5 deletions src/config/product.openshiftContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const config = {
[RHSM_API_QUERY_TYPES.OFFSET]: 0
},
inventorySubscriptionsQuery: {
[RHSM_API_QUERY_TYPES.SORT]: RHSM_API_QUERY_SUBSCRIPTIONS_SORT_TYPES.UPCOMING_EVENT_DATE,
[RHSM_API_QUERY_TYPES.SORT]: RHSM_API_QUERY_SUBSCRIPTIONS_SORT_TYPES.NEXT_EVENT_DATE,
[RHSM_API_QUERY_TYPES.DIRECTION]: SORT_DIRECTION_TYPES.DESCENDING,
[RHSM_API_QUERY_TYPES.LIMIT]: 100,
[RHSM_API_QUERY_TYPES.OFFSET]: 0
Expand Down Expand Up @@ -186,11 +186,11 @@ const config = {
cellWidth: 15
},
{
id: 'upcomingEventDate',
id: 'nextEventDate',
cell: data =>
(data?.upcomingEventDate?.value &&
helpers.isDate(data?.upcomingEventDate?.value) &&
moment.utc(data?.upcomingEventDate?.value).format('YYYY-DD-MM')) ||
(data?.nextEventDate?.value &&
helpers.isDate(data?.nextEventDate?.value) &&
moment.utc(data?.nextEventDate?.value).format('YYYY-DD-MM')) ||
'',
isSortable: true,
isWrappable: true,
Expand Down
10 changes: 5 additions & 5 deletions src/config/product.rhel.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const config = {
[RHSM_API_QUERY_TYPES.OFFSET]: 0
},
inventorySubscriptionsQuery: {
[RHSM_API_QUERY_TYPES.SORT]: RHSM_API_QUERY_SUBSCRIPTIONS_SORT_TYPES.UPCOMING_EVENT_DATE,
[RHSM_API_QUERY_TYPES.SORT]: RHSM_API_QUERY_SUBSCRIPTIONS_SORT_TYPES.NEXT_EVENT_DATE,
[RHSM_API_QUERY_TYPES.DIRECTION]: SORT_DIRECTION_TYPES.DESCENDING,
[RHSM_API_QUERY_TYPES.LIMIT]: 100,
[RHSM_API_QUERY_TYPES.OFFSET]: 0
Expand Down Expand Up @@ -197,11 +197,11 @@ const config = {
cellWidth: 15
},
{
id: 'upcomingEventDate',
id: 'nextEventDate',
cell: data =>
(data?.upcomingEventDate?.value &&
helpers.isDate(data?.upcomingEventDate?.value) &&
moment.utc(data?.upcomingEventDate?.value).format('YYYY-DD-MM')) ||
(data?.nextEventDate?.value &&
helpers.isDate(data?.nextEventDate?.value) &&
moment.utc(data?.nextEventDate?.value).format('YYYY-DD-MM')) ||
'',
isSortable: true,
isWrappable: true,
Expand Down
2 changes: 1 addition & 1 deletion src/config/product.satellite.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const config = {
[RHSM_API_QUERY_TYPES.OFFSET]: 0
},
inventorySubscriptionsQuery: {
[RHSM_API_QUERY_TYPES.SORT]: RHSM_API_QUERY_SUBSCRIPTIONS_SORT_TYPES.UPCOMING_EVENT_DATE,
[RHSM_API_QUERY_TYPES.SORT]: RHSM_API_QUERY_SUBSCRIPTIONS_SORT_TYPES.NEXT_EVENT_DATE,
[RHSM_API_QUERY_TYPES.DIRECTION]: SORT_DIRECTION_TYPES.DESCENDING,
[RHSM_API_QUERY_TYPES.LIMIT]: 100,
[RHSM_API_QUERY_TYPES.OFFSET]: 0
Expand Down
Loading