-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UIBULKED-367 Logs - Provide a link to file with identifiers of the re…
…cords affected by query (#467)
- Loading branch information
Showing
7 changed files
with
56 additions
and
6 deletions.
There are no files selected for viewing
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
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
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
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
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,15 @@ | ||
import { getFormattedFilePrefixDate } from '../constants'; | ||
|
||
export const getFileName = (item, triggeredFile) => { | ||
if (item.fqlQueryId) { | ||
return { | ||
linkToTriggeringCsvFile: `Query-${item.id}.csv`, | ||
linkToMatchedRecordsCsvFile: `${getFormattedFilePrefixDate()}-Matched-Records-Query-${item.id}.csv`, | ||
linkToModifiedRecordsCsvFile: `${getFormattedFilePrefixDate()}-Updates-Preview-Query-${item.id}.csv`, | ||
linkToCommittedRecordsCsvFile: `${getFormattedFilePrefixDate()}-Changed-Records-Query-${item.id}.csv`, | ||
linkToCommittedRecordsErrorsCsvFile: `${getFormattedFilePrefixDate()}-Committing-changes-Errors-Query-${item.id}.csv` | ||
}[triggeredFile]; | ||
} | ||
|
||
return item[triggeredFile].split('/')[1]; | ||
}; |
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,28 @@ | ||
import { getFileName } from './getFileName'; | ||
|
||
jest.mock('./date', () => ({ | ||
getFormattedFilePrefixDate: jest.fn(() => 'mockedDate'), | ||
})); | ||
|
||
describe('getFileName', () => { | ||
it('should return the correct file name for Query approach - linkToTriggeringCsvFile', () => { | ||
const item = { fqlQueryId: '111', id: 123 }; | ||
const triggeredFile = 'linkToTriggeringCsvFile'; | ||
const result = getFileName(item, triggeredFile); | ||
expect(result).toBe('Query-123.csv'); | ||
}); | ||
|
||
it('should return the correct file name for Query approach - linkToMatchedRecordsCsvFile', () => { | ||
const item = { fqlQueryId: '111', id: 123 }; | ||
const triggeredFile = 'linkToMatchedRecordsCsvFile'; | ||
const result = getFileName(item, triggeredFile); | ||
expect(result).toBe('mockedDate-Matched-Records-Query-123.csv'); | ||
}); | ||
|
||
it('should return the correct file name for non-Query approach', () => { | ||
const item = { fqlQueryId: null, linkToTriggeringCsvFile: 'somePath/someFile.csv' }; | ||
const triggeredFile = 'linkToTriggeringCsvFile'; | ||
const result = getFileName(item, triggeredFile); | ||
expect(result).toBe('someFile.csv'); | ||
}); | ||
}); |
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