Skip to content

Commit

Permalink
DEV align product config tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cdcabrera committed Feb 3, 2023
1 parent f5bc829 commit 4cdd211
Show file tree
Hide file tree
Showing 4 changed files with 168 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -624,3 +624,77 @@ exports[`Product OpenShift Container config should apply subscriptions inventory
},
}
`;

exports[`Product OpenShift Container config should apply subscriptions inventory configuration: filtered, infinite 1`] = `
{
"cells": [
{
"title": "lorem",
},
{
"title": "hello world",
},
{
"title": "",
},
{
"title": 2000,
},
{
"title": "2022-01-01",
},
],
"columnHeaders": [
{
"title": "t(curiosity-inventory.header_product, {"context":"name"})",
"transforms": [],
},
{
"title": "t(curiosity-inventory.header_service, {"context":"level"})",
"transforms": [
[Function],
],
},
{
"title": "t(curiosity-inventory.header, {"context":"quantity"})",
"transforms": [
[Function],
],
},
{
"title": "t(curiosity-inventory.header, {"context":"subscriptions"})",
"transforms": [
[Function],
],
},
{
"title": "t(curiosity-inventory.header_next_event, {"context":"date"})",
"transforms": [
[Function],
],
},
],
"data": {
"has_infinite_quantity": {
"title": "t(curiosity-inventory.header_has_infinite, {"context":"quantity"})",
"value": false,
},
"next_event_date": {
"title": "t(curiosity-inventory.header_next_event, {"context":"date"})",
"value": "2022-01-01T00:00:00.000Z",
},
"product_name": {
"title": "t(curiosity-inventory.header_product, {"context":"name"})",
"value": "lorem",
},
"service_level": {
"title": "t(curiosity-inventory.header_service, {"context":"level"})",
"value": "hello world",
},
"total_capacity": {
"title": "t(curiosity-inventory.header_total, {"context":"capacity"})",
"value": 2000,
},
},
}
`;
74 changes: 74 additions & 0 deletions src/config/__tests__/__snapshots__/product.rhel.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -706,3 +706,77 @@ exports[`Product RHEL config should apply subscriptions inventory configuration:
},
}
`;

exports[`Product RHEL config should apply subscriptions inventory configuration: filtered, infinite 1`] = `
{
"cells": [
{
"title": "lorem",
},
{
"title": "hello world",
},
{
"title": "",
},
{
"title": 2000,
},
{
"title": "2022-01-01",
},
],
"columnHeaders": [
{
"title": "t(curiosity-inventory.header_product, {"context":"name"})",
"transforms": [],
},
{
"title": "t(curiosity-inventory.header_service, {"context":"level"})",
"transforms": [
[Function],
],
},
{
"title": "t(curiosity-inventory.header, {"context":"quantity"})",
"transforms": [
[Function],
],
},
{
"title": "t(curiosity-inventory.header, {"context":"subscriptions"})",
"transforms": [
[Function],
],
},
{
"title": "t(curiosity-inventory.header_next_event, {"context":"date"})",
"transforms": [
[Function],
],
},
],
"data": {
"has_infinite_quantity": {
"title": "t(curiosity-inventory.header_has_infinite, {"context":"quantity"})",
"value": false,
},
"next_event_date": {
"title": "t(curiosity-inventory.header_next_event, {"context":"date"})",
"value": "2022-01-01T00:00:00.000Z",
},
"product_name": {
"title": "t(curiosity-inventory.header_product, {"context":"name"})",
"value": "lorem",
},
"service_level": {
"title": "t(curiosity-inventory.header_service, {"context":"level"})",
"value": "hello world",
},
"total_capacity": {
"title": "t(curiosity-inventory.header_total, {"context":"capacity"})",
"value": 2000,
},
},
}
`;
10 changes: 10 additions & 0 deletions src/config/__tests__/product.openshiftContainer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,16 @@ describe('Product OpenShift Container config', () => {

expect(fallbackFilteredInventoryData).toMatchSnapshot('filtered, fallback display');

const filteredInventoryDataInfinite = parseRowCellsListData({
filters: initialFilters,
cellData: {
...inventoryData,
[SUBSCRIPTIONS_INVENTORY_TYPES.HAS_INFINITE_QUANTITY]: false
}
});

expect(filteredInventoryDataInfinite).toMatchSnapshot('filtered, infinite');

expect(inventoryQuery[RHSM_API_QUERY_SET_TYPES.DIRECTION] === SORT_DIRECTION_TYPES.DESCENDING).toBe(true);
});

Expand Down
10 changes: 10 additions & 0 deletions src/config/__tests__/product.rhel.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,16 @@ describe('Product RHEL config', () => {

expect(fallbackFilteredInventoryData).toMatchSnapshot('filtered, fallback display');

const filteredInventoryDataInfinite = parseRowCellsListData({
filters: initialFilters,
cellData: {
...inventoryData,
[SUBSCRIPTIONS_INVENTORY_TYPES.HAS_INFINITE_QUANTITY]: false
}
});

expect(filteredInventoryDataInfinite).toMatchSnapshot('filtered, infinite');

expect(inventoryQuery[RHSM_API_QUERY_SET_TYPES.DIRECTION] === SORT_DIRECTION_TYPES.DESCENDING).toBe(true);
});

Expand Down

0 comments on commit 4cdd211

Please sign in to comment.