From 31ac216bf9a4c47ba2daed83404fabcf4754a98e Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Thu, 26 Feb 2026 08:38:18 +0000 Subject: [PATCH] test: add unit tests for getFileUploadErrorKey method - Introduced unit tests for the getFileUploadErrorKey method in the file uploading list row component. - Added tests for various error codes (500, 404, 403) and scenarios for null, undefined, and zero values to ensure correct key format retrieval. [ci:force] --- .../file-uploading-list-row.component.spec.ts | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/lib/content-services/src/lib/upload/components/file-uploading-list-row.component.spec.ts b/lib/content-services/src/lib/upload/components/file-uploading-list-row.component.spec.ts index 3ccb4774c6..ce77ff23e2 100644 --- a/lib/content-services/src/lib/upload/components/file-uploading-list-row.component.spec.ts +++ b/lib/content-services/src/lib/upload/components/file-uploading-list-row.component.spec.ts @@ -107,6 +107,38 @@ describe('FileUploadingListRowComponent', () => { expect(cancelButton.title).toBe('ADF_FILE_UPLOAD.BUTTON.STOP_FILE'); }); + describe('getFileUploadErrorKey', () => { + it('should return correct key format for error code 500', () => { + const result = component.getFileUploadErrorKey(500); + expect(result).toBe('FILE_UPLOAD.ERRORS.500'); + }); + + it('should return correct key format for error code 404', () => { + const result = component.getFileUploadErrorKey(404); + expect(result).toBe('FILE_UPLOAD.ERRORS.404'); + }); + + it('should return correct key format for error code 403', () => { + const result = component.getFileUploadErrorKey(403); + expect(result).toBe('FILE_UPLOAD.ERRORS.403'); + }); + + it('should return GENERIC key when errorCode is null', () => { + const result = component.getFileUploadErrorKey(null); + expect(result).toBe('FILE_UPLOAD.ERRORS.GENERIC'); + }); + + it('should return GENERIC key when errorCode is undefined', () => { + const result = component.getFileUploadErrorKey(undefined); + expect(result).toBe('FILE_UPLOAD.ERRORS.GENERIC'); + }); + + it('should return GENERIC key when errorCode is 0', () => { + const result = component.getFileUploadErrorKey(0); + expect(result).toBe('FILE_UPLOAD.ERRORS.GENERIC'); + }); + }); + describe('Toggle Icon State', () => { describe('onToggleMouseEnter', () => { it('should set isToggled to true when not focused', () => {