Skip to content

Commit

Permalink
fix(inventoryCardSubscriptionsContext): ent-4572 sort types (#890)
Browse files Browse the repository at this point in the history
  • Loading branch information
cdcabrera authored Feb 22, 2022
1 parent f98fcb5 commit 083f81f
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`InventoryCardContext should expect specific sort properties: sort properties 1`] = `
Object {
"CORES": "Cores",
"CORE_SECONDS": "Core-seconds",
"INSTANCE_HOURS": "Instance-hours",
"LAST_SEEN": "last_seen",
"NAME": "display_name",
"SOCKETS": "Sockets",
"STORAGE_GIBIBYTES": "Storage-gibibytes",
"TRANSFER_GIBIBYTES": "Transfer-gibibytes",
}
`;

exports[`InventoryCardContext should handle an onColumnSort event: onColumnSort event, dispatch 1`] = `
Array [
Array [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,20 @@ import {
useOnPageInstances,
useOnColumnSortInstances
} from '../inventoryCardContext';
import { RHSM_API_QUERY_INVENTORY_SORT_DIRECTION_TYPES as SORT_DIRECTION_TYPES } from '../../../services/rhsm/rhsmConstants';
import {
RHSM_API_QUERY_INVENTORY_SORT_DIRECTION_TYPES as SORT_DIRECTION_TYPES,
RHSM_API_QUERY_INVENTORY_SORT_TYPES as SORT_TYPES
} from '../../../services/rhsm/rhsmConstants';

describe('InventoryCardContext', () => {
it('should return specific properties', () => {
expect(context).toMatchSnapshot('specific properties');
});

it('should expect specific sort properties', () => {
expect(SORT_TYPES).toMatchSnapshot('sort properties');
});

it('should handle instances inventory API responses', async () => {
const { result: errorResponse } = shallowHook(() =>
useGetInstancesInventory({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`InventoryCardSubscriptionsContext should expect specific sort properties: sort properties 1`] = `
Object {
"NEXT_EVENT_DATE": "next_event_date",
"NEXT_EVENT_TYPE": "next_event_type",
"QUANTITY": "quantity",
"SERVICE_LEVEL": "service_level",
"SKU": "sku",
"USAGE": "usage",
}
`;

exports[`InventoryCardSubscriptionsContext should handle an onColumnSort event: onColumnSort event, dispatch 1`] = `
Array [
Array [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,20 @@ import {
useOnPageSubscriptions,
useOnColumnSortSubscriptions
} from '../inventoryCardSubscriptionsContext';
import { RHSM_API_QUERY_INVENTORY_SORT_DIRECTION_TYPES as SORT_DIRECTION_TYPES } from '../../../services/rhsm/rhsmConstants';
import {
RHSM_API_QUERY_INVENTORY_SORT_DIRECTION_TYPES as SORT_DIRECTION_TYPES,
RHSM_API_QUERY_INVENTORY_SUBSCRIPTIONS_SORT_TYPES as SORT_TYPES
} from '../../../services/rhsm/rhsmConstants';

describe('InventoryCardSubscriptionsContext', () => {
it('should return specific properties', () => {
expect(context).toMatchSnapshot('specific properties');
});

it('should expect specific sort properties', () => {
expect(SORT_TYPES).toMatchSnapshot('sort properties');
});

it('should handle instances inventory API responses', async () => {
const { result: errorResponse } = shallowHook(() =>
useGetSubscriptionsInventory({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { reduxActions, reduxTypes, storeHooks } from '../../redux';
import { useProduct, useProductInventorySubscriptionsQuery } from '../productView/productViewContext';
import {
RHSM_API_QUERY_INVENTORY_SORT_DIRECTION_TYPES as SORT_DIRECTION_TYPES,
RHSM_API_QUERY_INVENTORY_SORT_TYPES as SORT_TYPES,
RHSM_API_QUERY_INVENTORY_SUBSCRIPTIONS_SORT_TYPES as SORT_TYPES,
RHSM_API_QUERY_SET_TYPES
} from '../../services/rhsm/rhsmConstants';
import { helpers } from '../../common';
Expand Down

0 comments on commit 083f81f

Please sign in to comment.