diff --git a/projects/aca-content/src/lib/components/bulk-actions-dropdown/bulk-actions-dropdown.component.spec.ts b/projects/aca-content/src/lib/components/bulk-actions-dropdown/bulk-actions-dropdown.component.spec.ts index 1665a053c..7d804b2bb 100644 --- a/projects/aca-content/src/lib/components/bulk-actions-dropdown/bulk-actions-dropdown.component.spec.ts +++ b/projects/aca-content/src/lib/components/bulk-actions-dropdown/bulk-actions-dropdown.component.spec.ts @@ -67,6 +67,11 @@ describe('BulkActionsDropdownComponent', () => { const getLabelText = (selector: string): string => getElement(selector).textContent.trim(); + const getPlaceholderText = async (): Promise => { + const selectHarness = await loader.getHarness(MatSelectHarness); + return selectHarness.getValueText(); + }; + const selectOptionFromDropdown = async (selectionIndex: number) => { const selectHarness = await loader.getHarness(MatSelectHarness); await selectHarness.open(); @@ -91,6 +96,7 @@ describe('BulkActionsDropdownComponent', () => { component.items = [mockItem]; fixture.detectChanges(); + loader = TestbedHarnessEnvironment.loader(fixture); }); it('should create', () => { @@ -109,8 +115,8 @@ describe('BulkActionsDropdownComponent', () => { expect(dropdown.getAttribute('aria-disabled')).toBe('true'); }); - it('should have correct placeholder', () => { - expect(getLabelText('aca-bulk-actions-dropdown')).toEqual('SEARCH.BULK_ACTIONS_DROPDOWN.BULK_NOT_AVAILABLE'); + it('should have correct placeholder', async () => { + await expect(await getPlaceholderText()).toEqual('SEARCH.BULK_ACTIONS_DROPDOWN.BULK_NOT_AVAILABLE'); }); it('should call translationService.get with correct arguments', () => { @@ -132,8 +138,8 @@ describe('BulkActionsDropdownComponent', () => { expect(dropdown.getAttribute('aria-disabled')).toBe('false'); }); - it('should have correct placeholder', () => { - expect(getLabelText('aca-bulk-actions-dropdown')).toEqual('SEARCH.BULK_ACTIONS_DROPDOWN.TITLE'); + it('should have correct placeholder', async () => { + await expect(await getPlaceholderText()).toEqual('SEARCH.BULK_ACTIONS_DROPDOWN.TITLE'); }); it('should have option with correct tooltip', () => { @@ -163,7 +169,6 @@ describe('BulkActionsDropdownComponent', () => { extensionService = TestBed.inject(AppExtensionService); spyOn(extensionService, 'getBulkActions').and.returnValue(of([mockItem])); fixture.detectChanges(); - loader = TestbedHarnessEnvironment.loader(fixture); }); it('should run action on selection', async () => { diff --git a/projects/aca-content/src/lib/components/search/search-save/list/smart-list/saved-searches-smart-list.component.html b/projects/aca-content/src/lib/components/search/search-save/list/smart-list/saved-searches-smart-list.component.html index dba68c6e2..2dcba5f9d 100644 --- a/projects/aca-content/src/lib/components/search/search-save/list/smart-list/saved-searches-smart-list.component.html +++ b/projects/aca-content/src/lib/components/search/search-save/list/smart-list/saved-searches-smart-list.component.html @@ -23,7 +23,7 @@ } @else { diff --git a/projects/aca-content/src/lib/dialogs/node-details/node-information.component.spec.ts b/projects/aca-content/src/lib/dialogs/node-details/node-information.component.spec.ts index 97c37aa8e..36c5b1f3f 100644 --- a/projects/aca-content/src/lib/dialogs/node-details/node-information.component.spec.ts +++ b/projects/aca-content/src/lib/dialogs/node-details/node-information.component.spec.ts @@ -138,8 +138,8 @@ describe('NodeInformationComponent', () => { expect(getNumberOfFiles()).toBe('APP.NODE_INFO.CALCULATING'); expect(getNodeSize()).toBe('APP.NODE_INFO.CALCULATING'); expect(getNodeLocation()).toBe('mock-folder-path'); - expect(getNodeCreationDate()).toBe('2/1/24, 11:11 AM'); - expect(getNodeModifyDate()).toBe('3/2/24, 10:22 PM'); + expect(getNodeCreationDate()).toBe('2/1/24, 11:11 AM'); + expect(getNodeModifyDate()).toBe('3/2/24, 10:22 PM'); }); it('should make API call on init to start folder size calculation', () => { @@ -243,8 +243,8 @@ describe('NodeInformationComponent', () => { expect(getNodeName()).toBe('mock-file'); expect(getNodeSize()).toBe('1000 CORE.FILE_SIZE.BYTES'); expect(getNodeLocation()).toBe('mock-file-path'); - expect(getNodeCreationDate()).toBe('2/1/24, 11:11 AM'); - expect(getNodeModifyDate()).toBe('3/2/24, 10:22 PM'); + expect(getNodeCreationDate()).toBe('2/1/24, 11:11 AM'); + expect(getNodeModifyDate()).toBe('3/2/24, 10:22 PM'); }); it('should call API to fetch secondary parent paths', () => { @@ -282,8 +282,8 @@ describe('NodeInformationComponent', () => { expect(getNodeName()).toBe('mock-file-link'); expect(getNodeSize()).toBe('APP.NODE_INFO.NOT_AVAILABLE'); expect(getNodeLocation()).toBe('mock-file-link-path'); - expect(getNodeCreationDate()).toBe('2/1/24, 11:11 AM'); - expect(getNodeModifyDate()).toBe('3/2/24, 10:22 PM'); + expect(getNodeCreationDate()).toBe('2/1/24, 11:11 AM'); + expect(getNodeModifyDate()).toBe('3/2/24, 10:22 PM'); expect(nodeService.initiateFolderSizeCalculation).not.toHaveBeenCalled(); }); @@ -296,8 +296,8 @@ describe('NodeInformationComponent', () => { expect(getNodeSize()).toBe('APP.NODE_INFO.NOT_AVAILABLE'); expect(getNumberOfFiles()).toBe('APP.NODE_INFO.NOT_AVAILABLE'); expect(getNodeLocation()).toBe('mock-folder-link-path'); - expect(getNodeCreationDate()).toBe('2/1/24, 11:11 AM'); - expect(getNodeModifyDate()).toBe('3/2/24, 10:22 PM'); + expect(getNodeCreationDate()).toBe('2/1/24, 11:11 AM'); + expect(getNodeModifyDate()).toBe('3/2/24, 10:22 PM'); expect(nodeService.initiateFolderSizeCalculation).not.toHaveBeenCalled(); }); }); diff --git a/projects/aca-shared/src/lib/components/toolbar/toolbar-menu-item/toolbar-menu-item.component.spec.ts b/projects/aca-shared/src/lib/components/toolbar/toolbar-menu-item/toolbar-menu-item.component.spec.ts index 3d7df8ae1..e7decf7e4 100644 --- a/projects/aca-shared/src/lib/components/toolbar/toolbar-menu-item/toolbar-menu-item.component.spec.ts +++ b/projects/aca-shared/src/lib/components/toolbar/toolbar-menu-item/toolbar-menu-item.component.spec.ts @@ -59,6 +59,10 @@ describe('ToolbarMenuItemComponent', () => { appExtensionService = TestBed.inject(AppExtensionService); }); + afterEach(() => { + fixture.destroy(); + }); + it('should run action on click', async () => { const runActionById = spyOn(appExtensionService, 'runActionById'); diff --git a/projects/aca-shared/test.ts b/projects/aca-shared/test.ts index 4c2f9061c..904dd9c7d 100644 --- a/projects/aca-shared/test.ts +++ b/projects/aca-shared/test.ts @@ -26,10 +26,15 @@ import 'zone.js'; import 'zone.js/testing'; -import { getTestBed } from '@angular/core/testing'; +import { getTestBed, TestBed } from '@angular/core/testing'; import { BrowserTestingModule, platformBrowserTesting } from '@angular/platform-browser/testing'; +import { provideZoneChangeDetection } from '@angular/core'; // First, initialize the Angular testing environment. getTestBed().initTestEnvironment(BrowserTestingModule, platformBrowserTesting(), { teardown: { destroyAfterEach: false } }); + +beforeEach(() => { + TestBed.configureTestingModule({ providers: [provideZoneChangeDetection()] }); +});