Skip to content

Commit

Permalink
fix(platformTransformers): sw-2769 add format to export filename (#1375)
Browse files Browse the repository at this point in the history
  • Loading branch information
cdcabrera committed Aug 2, 2024
1 parent 386175a commit 9e8ef0b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ exports[`Platform Transformers should attempt to parse an exports response: expo
"isAnythingPending": true,
"pending": [
{
"fileName": "20190720_000000_swatch_report_rhel_for_x_86",
"format": undefined,
"fileName": "20190720_000000_csv_swatch_report_rhel_for_x_86",
"format": "csv",
"id": "0123456789",
"name": "swatch-RHEL for x86",
"productId": "RHEL for x86",
Expand All @@ -103,8 +103,8 @@ exports[`Platform Transformers should attempt to parse an exports response: expo
"isPending": true,
"pending": [
{
"fileName": "20190720_000000_swatch_report_rhel_for_x_86",
"format": undefined,
"fileName": "20190720_000000_csv_swatch_report_rhel_for_x_86",
"format": "csv",
"id": "0123456789",
"name": "swatch-RHEL for x86",
"productId": "RHEL for x86",
Expand Down
8 changes: 6 additions & 2 deletions src/services/platform/__tests__/platformTransformers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ describe('Platform Transformers', () => {
[platformConstants.PLATFORM_API_EXPORT_RESPONSE_TYPES.EXPIRES_AT]: '2019-07-14T00:00:00Z',
[platformConstants.PLATFORM_API_EXPORT_RESPONSE_TYPES.ID]: '0123456789',
[platformConstants.PLATFORM_API_EXPORT_RESPONSE_TYPES.STATUS]:
platformConstants.PLATFORM_API_EXPORT_STATUS_TYPES.PENDING
platformConstants.PLATFORM_API_EXPORT_STATUS_TYPES.PENDING,
[platformConstants.PLATFORM_API_EXPORT_RESPONSE_TYPES.FORMAT]:
platformConstants.PLATFORM_API_EXPORT_CONTENT_TYPES.CSV
});

const parsedArray = platformTransformers.exports({
Expand All @@ -33,7 +35,9 @@ describe('Platform Transformers', () => {
[platformConstants.PLATFORM_API_EXPORT_RESPONSE_TYPES.EXPIRES_AT]: '2019-07-14T00:00:00Z',
[platformConstants.PLATFORM_API_EXPORT_RESPONSE_TYPES.ID]: '0123456789',
[platformConstants.PLATFORM_API_EXPORT_RESPONSE_TYPES.STATUS]:
platformConstants.PLATFORM_API_EXPORT_STATUS_TYPES.PENDING
platformConstants.PLATFORM_API_EXPORT_STATUS_TYPES.PENDING,
[platformConstants.PLATFORM_API_EXPORT_RESPONSE_TYPES.FORMAT]:
platformConstants.PLATFORM_API_EXPORT_CONTENT_TYPES.CSV
}
]
});
Expand Down
2 changes: 1 addition & 1 deletion src/services/platform/platformTransformers.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const exports = response => {
const focusedStatus = getStatus(exportStatus);

const updatedExportData = {
fileName: `${moment.utc(dateHelpers.getCurrentDate()).format('YYYYMMDD_HHmmss')}_${helpers.CONFIG_EXPORT_FILENAME.replace('{0}', _snakeCase(productId))}`,
fileName: `${moment.utc(dateHelpers.getCurrentDate()).format('YYYYMMDD_HHmmss')}_${exportFormat}_${helpers.CONFIG_EXPORT_FILENAME.replace('{0}', _snakeCase(productId))}`,
format: exportFormat,
id: exportId,
name: exportName,
Expand Down

0 comments on commit 9e8ef0b

Please sign in to comment.