Conversation
WalkthroughThis pull request enables previously skipped test suites across 80+ spec files and refactors test infrastructure to use corrected service names throughout the codebase. Additionally, it updates model types for timestamp fields and expands mock fixture data with additional properties. Changes
Sequence Diagram(s)Sequence diagrams are not applicable for this change set, as the modifications primarily involve test infrastructure enablement and service naming corrections without introducing new features or altering control flow. Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🔁 Code Duplication Report - Angular
📊 No significant change in code duplication. |
There was a problem hiding this comment.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (14)
src/app/shared/components/helper/mapping/mapping-filter/mapping-filter.component.spec.ts (2)
35-37: Fix test logic: Form initialized with value but test expects null.The test "clearSearch function check" initializes
searchOptionwith'efe'(line 23) during setup, but then asserts thatsearchOption.valueisnull(line 36). This logic is inverted. Either the form should be initialized with null/empty, or the test should clear the value before asserting.Additionally, the test name suggests checking a "clearSearch function" but does not actually invoke any function. Clarify the intent: are you testing the function
clearSearch()or just verifying initial state?
39-45: Remove or complete empty test case.The test "onFocusOut function check" defines an event object but contains no assertions or function invocations. The test body is empty and will trivially pass, providing no value. Either implement the test logic to verify the
onFocusOutfunction behavior, or remove this test case.src/app/core/services/qbd/qbd-core/qbd-mapping.service.spec.ts (1)
33-79: Consolidate duplicate test cases.Both test cases are named "getMapping function check", which violates test naming best practices and makes debugging difficult when failures occur. Additionally, the first test (lines 33-79) only verifies
MappingState.ALL, while the second test (lines 81-143) already covers all threeMappingStatevariations includingALL. The first test is redundant.Consider removing the first test case entirely since the second test provides more comprehensive coverage:
- it('getMapping function check', () => { - const mappingResponse:QBDMappingResponse = { - "count": 16, - "next": "http://localhost:8008/api/workspaces/4/qbd_mappings/?attribute_type=CORPORATE_CARD&limit=10&offset=10", - "previous": "null", - "results": [ - { - "id": 59, - "attribute_type": "CORPORATE_CARD", - "source_value": "Bank of America - 1319", - "source_id": "baccK5ssSzxv1g", - "destination_value": "eefs", - "created_at": new Date("2023-09-01T08:32:40.176736Z"), - "updated_at": new Date("2023-09-01T08:32:40.176736Z"), - "workspace": 4 - }, - { - "id": 61, - "attribute_type": "CORPORATE_CARD", - "source_value": "American Express - 58057", - "source_id": "baccsWbRJpSbnB", - "destination_value": null, - "created_at": new Date("2023-09-01T08:32:40.176736Z"), - "updated_at": new Date("2023-09-01T08:32:40.176736Z"), - "workspace": 4 - }, - { - "id": 62, - "attribute_type": "CORPORATE_CARD", - "source_value": "American Express - 83167", - "source_id": "baccAGZQWkwSnZ", - "destination_value": null, - "created_at": new Date("2023-09-01T08:32:40.176736Z"), - "updated_at": new Date("2023-09-01T08:32:40.176736Z"), - "workspace": 4 - } - ] - }; - service.getMappings(10, 0, 'CORPORATE_CARD', MappingState.ALL, 'Anish').subscribe((value) => { - expect(value).toEqual(mappingResponse); - }); - const req = httpMock.expectOne({ - method: 'GET', - url: `${API_BASE_URL}/workspaces/${workspace_id}/qbd_mappings/?limit=10&offset=0&attribute_type=CORPORATE_CARD` - }); - req.flush(mappingResponse); - }); - - it('getMapping function check', () => { + it('getMappings should handle all MappingState variations', () => {Also applies to: 81-143
src/app/shared/components/configuration/configuration-select-field/configuration-select-field.component.spec.ts (1)
46-53: Fix typo in test description and consider strengthening test assertions.The test description has a typo: "ngOnInt" should be "ngOnInit".
Additionally, the test only verifies that
ngOnInit()returnsundefined, which doesn't validate actual component behavior. Consider testing state changes or side effects instead of the return value of a lifecycle hook.Apply this diff to fix the typo:
- it('ngOnInt function check', () => { + it('ngOnInit function check', () => { component.formControllerName = 'dayOfWeek'; fixture.detectChanges(); expect(component.ngOnInit()).toBeUndefined(); component.formControllerName = 'timeOfDay'; fixture.detectChanges(); expect(component.ngOnInit()).toBeUndefined(); });For a more robust test, consider verifying component state or form control values after
ngOnInit()executes rather than checking its return value.src/app/core/services/qbd/qbd-core/qbd-workspace.service.spec.ts (1)
85-97: Rename the second test to avoid duplicate test names.Both tests at lines 85 and 92 have identical names, which reduces clarity and maintainability. The second test checks a different scenario (default state when localStorage is empty) and should have a distinct name.
Apply this diff to give the second test a more descriptive name:
- it('setOnboardingState and getOnboardingState service', () => { + it('getOnboardingState service returns default state when not set', () => { localStorage.removeItem('QBDOnboardingState'); const state = 'EXPORT_SETTINGS'; const response = service.getOnboardingState(); expect(state).toEqual(response); });src/app/shared/components/configuration/preview-dialog/preview-dialog.component.spec.ts (1)
5-22: Missing dependency provider in TestBed configuration will cause test failure.
PreviewDialogComponenthas a constructor dependency onHelperService(line 33 of preview-dialog.component.ts), but the TestBed configuration doesn't provide it. The test will fail at runtime with "No provider for HelperService" whenfixture.createComponent()executes.Add
HelperService(or a mock) to the TestBed providers array:await TestBed.configureTestingModule({ declarations: [ PreviewDialogComponent ], providers: [ HelperService ] // or { provide: HelperService, useValue: mockHelperService } })src/app/integrations/landing-v2/landing-v2.component.spec.ts (1)
5-23: Test will fail due to unmocked dependencies; proper mocks must be configured before enabling.
LandingV2Componenthas 6 injected dependencies (EventsService, Router, StorageService, OrgService, IntegrationsService, TrackingService) plus field initialization that callsthis.orgService.getCachedOrg(). The current TestBed configuration only declares the component without providing any mocks or providers, causing dependency injection to fail when the test runs.Additionally, this aligns with the project's coding guideline that component spec files should not be added. While this re-enables an existing spec rather than adding a new one, enabling it requires providing proper test doubles for all dependencies.
Before changing
xdescribetodescribe, configure the TestBed with appropriate mocks for all services:
- EventsService
- Router
- StorageService
- OrgService (critical for field initialization)
- IntegrationsService
- TrackingService
src/app/shared/components/configuration/configuration-skip-export/configuration-skip-export.component.spec.ts (1)
5-22: Test suite will fail due to missing dependency injection providers.The component has two constructor dependencies (
HelperService,TranslocoService) that are not provided in the test'sTestBedconfiguration. When enabled, this test will fail immediately with aNullInjectorErroron component instantiation.Either provide these dependencies via
TestBed.configureTestingModule()with properly mocked/stubbed services, or keep the test disabled until the setup is complete.src/app/shared/components/dashboard/dashboard-export-summary-section/dashboard-export-summary-section.component.spec.ts (1)
9-22: This test will fail due to missing service providers and initialization errors.The component requires four injected services (
AccountingExportService,ExportLogService,UserService,TranslocoService) but the test provides none. Additionally, the component initializesorg_idat property declaration time (line 48) by callingthis.userService.getUserProfile(), which will crash the test before component instantiation completes.The test needs:
- Mock providers for all four services
- @input values for required properties (
accountingExportSummary,appName,accountingExportType,isRealTimeExportEnabled)src/app/shared/components/helper/mandatory-error-message/mandatory-error-message.component.spec.ts (2)
25-25: Fix duplicate test names and typo.Two issues:
- Both test cases have identical names, making it difficult to identify failures.
- Typo: "consonent" should be "consonant".
Apply this diff:
- it('listName input with a consonent check', () => { + it('listName input with a consonant (single word) check', () => { component.listName = 'Fyle';- it('listName input with a consonent check', () => { + it('listName input with a consonant (multi-word) check', () => { component.listName = 'how fyle';Also applies to: 35-35
56-56: Fix typo in test data.Typo: "meaningfull" should be "meaningful".
Apply this diff:
- component.customErrorMessage = 'Fyle requires a meaningfull word'; + component.customErrorMessage = 'Fyle requires a meaningful word';src/app/core/services/org/org.service.spec.ts (1)
83-95: Fix duplicate test name.This test has the same name as the test on lines 69-81: "should connect Fyle". While they test different scenarios (one without AppName parameter, one with
AppName.BAMBOO_HR), having duplicate test names causes confusion in test reports and may lead to issues with some test runners.Apply this diff to fix the duplicate test name:
- it('should connect Fyle', () => { + it('should connect Fyle with AppName parameter', () => { spyOn(service, 'getOrgId').and.returnValue('1');src/app/core/services/qbd/qbd-configuration/qbd-field-mapping.service.spec.ts (1)
54-74: Missing service method call in test.The test creates a payload and sets up an HTTP mock expectation but never actually calls the service method (e.g.,
service.postQbdFieldMapping(FieldMappingPayload)). This will cause the test to fail because the expected HTTP request is never triggered.Apply this diff to fix the test:
it('postQbdFieldMappings service check', () => { const FieldMappingPayload: QBDFieldMappingPost = { class_type: null, project_type: "PROJECT", item_type: "Anish" }; const response={ id: 1, created_at: new Date('2023-02-01T08:42:45.803382Z'), updated_at: new Date('2023-02-01T08:42:45.803382Z'), class_type: null, project_type: "PROJECT", workspace: 1 }; + service.postQbdFieldMapping(FieldMappingPayload).subscribe((value) => { + expect(value).toEqual(response); + }); const req = httpMock.expectOne({ method: 'POST', url: `${API_BASE_URL}/workspaces/${workspace_id}/field_mappings/` }); req.flush(response); });src/app/integrations/qbo/qbo.fixture.ts (1)
2213-2232: Set skipped fixtures tois_skipped = true.
These entries come from the Skip Export feed, so leavingis_skippedasfalsemeans any test using this fixture will treat them as exportable and mask the skip-specific behavior we’re trying to cover. Please flip the flag totruehere and in the other newly added skipped fixtures so the mock data mirrors production responses.- is_skipped: false, + is_skipped: true,
🧹 Nitpick comments (12)
src/app/integrations/qbd/qbd-main/qbd-mapping/qbd-generic-mapping/qbd-generic-mapping.component.spec.ts (1)
76-80: Review error-throwing pattern in postMapping test.Line 78 uses
throwError({Error})to simulate an error. This syntax doesn't properly create an Error object. Consider using a standard pattern likethrowError(() => new Error('test error'))for better error handling consistency.- spyOn(mappingService, 'postMappings').and.returnValue(throwError({Error})); + spyOn(mappingService, 'postMappings').and.returnValue(throwError(() => new Error('Failed to post mapping')));src/app/core/services/qbo/qbo-configuration/qbo-clone-settings.service.spec.ts (1)
6-22: LGTM: Consistent service rename throughout the test suite.All references to the service have been correctly updated from
UqboUcloneUsettingsServicetoQboCloneSettingsServicein the describe block, type declaration, providers, and injection point. The test setup correctly uses Angular 18's modern HTTP testing patterns.The current test only verifies service creation. While this is acceptable for the scope of this PR, consider adding tests for the service's public methods in a follow-up to improve coverage.
src/app/shared/components/configuration/configuration-radio-field/configuration-radio-field.component.spec.ts (1)
31-33: Consider expanding test coverage.The test suite only verifies component instantiation. The
optionsconfigured inbeforeEach(lines 18-27) are never asserted, suggesting opportunities to test radio field behavior, option rendering, or value selection.src/app/core/services/common/workspace.service.spec.ts (1)
93-98: Rename the duplicate test name for clarity.This test has the same name as the test on line 86, but tests a different scenario (behavior when
QBDOnboardingStateis removed from localStorage). Consider renaming it to something like "getOnboardingState should return default state when localStorage is empty".Apply this diff to improve test clarity:
- it('setOnboardingState and getOnboardingState service', () => { + it('getOnboardingState should return default state when localStorage is empty', () => { localStorage.removeItem('QBDOnboardingState'); const state = 'EXPORT_SETTINGS'; const response = service.getOnboardingState(); expect(state).toEqual(response); });src/app/core/services/common/integrations-toast.service.spec.ts (1)
20-22: Consider verifying MessageService interaction.The test currently only checks that
displayToastMessagereturnsundefined, but doesn't verify that the toast message was actually added viaMessageService. Consider using a spy to verify the service interaction and message parameters.Example improvement:
it('displayToastMessage function test', () => { + const messageService = TestBed.inject(MessageService); + const addSpy = spyOn(messageService, 'add'); + - expect(service.displayToastMessage(ToastSeverity.SUCCESS, 'Advanced settings saved successfully')).toBeUndefined(); + service.displayToastMessage(ToastSeverity.SUCCESS, 'Advanced settings saved successfully'); + + expect(addSpy).toHaveBeenCalledWith({ + severity: ToastSeverity.SUCCESS, + summary: 'Advanced settings saved successfully' + }); });src/app/core/services/qbd/qbd-core/qbd-auth.service.spec.ts (1)
30-60: Consider strengthening test assertions.The test only validates response key structure but doesn't verify actual values. Additionally, error cases aren't covered.
Consider these improvements:
- Validate response values, not just keys:
- service.qbdLogin('eeeee').subscribe(value => { - const responseKeys = Object.keys(qbdLoginResponse).sort(); - const actualResponseKeys = Object.keys(value).sort(); - expect(actualResponseKeys).toEqual(responseKeys); + service.qbdLogin('test-token').subscribe(value => { + expect(value.access_token).toBe(qbdLoginResponse.access_token); + expect(value.user.email).toBe(qbdLoginResponse.user.email); + // ... validate other critical fields });
- Add error case coverage:
it('should handle login failure', () => { service.qbdLogin('invalid-token').subscribe({ error: (error) => { expect(error.status).toBe(401); } }); const req = httpMock.expectOne({ method: 'POST', url: `${API_BASE_URL}/auth/login_with_refresh_token/` }); req.flush('Unauthorized', { status: 401, statusText: 'Unauthorized' }); });src/app/core/services/common/storage.service.spec.ts (1)
8-11: Consider adding cleanup to prevent test pollution.The tests directly modify
localStoragewithout cleanup, which could cause state leakage between test runs. Consider adding anafterEachhook to clear test data.Apply this diff to add cleanup:
beforeEach(() => { TestBed.configureTestingModule({}); service = TestBed.inject(StorageService); }); + + afterEach(() => { + localStorage.clear(); + });src/app/core/services/travelperk/travelperk-configuration/travelperk-payment-profile-settings.service.spec.ts (1)
20-22: Consider expanding test coverage.The current test only verifies service instantiation. Consider adding tests for the service's actual methods and functionality to ensure proper behavior and catch potential regressions.
src/app/core/services/qbd/qbd-core/qbd-workspace.service.spec.ts (1)
29-75: Consider strengthening test assertions.The tests for
postQBDWorkspaceandgetQBDWorkspaceonly verify that response keys match the expected keys, but don't validate the actual values. Consider comparing the full response objects to catch potential value mismatches.For example, for the
postQBDWorkspacetest:service.postQBDWorkspace().subscribe((value) => { - const responseKeys = Object.keys(workspaceResponse).sort(); - const actualResponseKeys = Object.keys(value).sort(); - expect(actualResponseKeys).toEqual(responseKeys); + expect(value).toEqual(workspaceResponse); });src/app/shared/components/configuration/email-multi-select-field/email-multi-select-field.component.spec.ts (1)
64-74: Consider testing behavior instead of implementation details.A few test pattern observations:
- Line 64 tests a private method by casting to
any, which breaks encapsulation- Lines 68 and 74 assert that methods return
undefined, which is a weak assertion that doesn't verify meaningful behaviorConsider refactoring these tests to:
- Test public APIs and observable side effects rather than private methods
- Assert on state changes, DOM updates, or form value changes rather than undefined returns
src/app/shared/components/input/search/search.component.spec.ts (1)
5-23: Consider expanding test coverage beyond the smoke test.Currently, the test suite only contains a basic instantiation check. For a search component, consider adding tests for:
- Search input value changes
- Search submission/trigger behavior
- Clear/reset functionality
- Debouncing (if implemented)
- Event emission verification
This can be deferred to a future PR focused on improving test quality.
src/app/core/guard/tenant.guard.spec.ts (1)
4-4: Good to enable the test suite. Note naming inconsistency.The test suite is named 'WorkspacesGuard' but tests
TenantGuard. Consider aligning the describe block name with the actual guard name for clarity.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (107)
src/app/app.component.spec.ts(1 hunks)src/app/auth/login/login.component.spec.ts(1 hunks)src/app/core/guard/qbo-token.guard.spec.ts(1 hunks)src/app/core/guard/sage300-token.guard.spec.ts(1 hunks)src/app/core/guard/tenant.guard.spec.ts(1 hunks)src/app/core/guard/xero-token.guard.spec.ts(1 hunks)src/app/core/interceptor/jwt.interceptor.spec.ts(1 hunks)src/app/core/models/db/expense.model.ts(1 hunks)src/app/core/services/bamboo-hr/bamboo-hr.service.spec.ts(1 hunks)src/app/core/services/common/advanced-settings.service.spec.ts(1 hunks)src/app/core/services/common/auth.service.spec.ts(1 hunks)src/app/core/services/common/clone-setting.service.spec.ts(1 hunks)src/app/core/services/common/clone-settings.service.spec.ts(1 hunks)src/app/core/services/common/configuration.service.spec.ts(1 hunks)src/app/core/services/common/csv-json-translator.service.spec.ts(1 hunks)src/app/core/services/common/employee-settings.service.spec.ts(1 hunks)src/app/core/services/common/export-settings.service.spec.ts(1 hunks)src/app/core/services/common/helper.service.spec.ts(1 hunks)src/app/core/services/common/import-settings.service.spec.ts(1 hunks)src/app/core/services/common/integrations-toast.service.spec.ts(1 hunks)src/app/core/services/common/storage.service.spec.ts(1 hunks)src/app/core/services/common/workspace.service.spec.ts(1 hunks)src/app/core/services/misc/user.service.spec.ts(1 hunks)src/app/core/services/netsuite/netsuite-configuration/netsuite-onboarding.service.spec.ts(1 hunks)src/app/core/services/org/org.fixture.ts(1 hunks)src/app/core/services/org/org.service.spec.ts(1 hunks)src/app/core/services/qbd-direct/qbd-direct-configuration/qbd-direct-assisted-setup.service.spec.ts(1 hunks)src/app/core/services/qbd-direct/qbd-direct-configuration/qbd-direct-onboarding.service.spec.ts(1 hunks)src/app/core/services/qbd/qbd-configuration/qbd-advanced-setting.service.spec.ts(1 hunks)src/app/core/services/qbd/qbd-configuration/qbd-advanced-settings.service.spec.ts(1 hunks)src/app/core/services/qbd/qbd-configuration/qbd-export-setting.service.spec.ts(1 hunks)src/app/core/services/qbd/qbd-configuration/qbd-export-settings.service.spec.ts(1 hunks)src/app/core/services/qbd/qbd-configuration/qbd-field-mapping.service.spec.ts(1 hunks)src/app/core/services/qbd/qbd-core/qbd-auth.service.spec.ts(1 hunks)src/app/core/services/qbd/qbd-core/qbd-iif-logs.service.spec.ts(1 hunks)src/app/core/services/qbd/qbd-core/qbd-mapping.service.spec.ts(1 hunks)src/app/core/services/qbd/qbd-core/qbd-workspace.service.spec.ts(1 hunks)src/app/core/services/qbo/qbo-configuration/qbo-clone-settings.service.spec.ts(1 hunks)src/app/core/services/qbo/qbo-configuration/qbo-onboarding.service.spec.ts(1 hunks)src/app/core/services/sage300/sage300-configuration/sage300-export-settings.service.spec.ts(1 hunks)src/app/core/services/sage50/sage50-configuration/sage50-import-attributes.service.spec.ts(1 hunks)src/app/core/services/sage50/sage50-configuration/sage50-import-settings.service.spec.ts(1 hunks)src/app/core/services/sage50/sage50-configuration/sage50-onboarding.service.spec.ts(1 hunks)src/app/core/services/si/si-configuration/si-advanced-settings.service.spec.ts(1 hunks)src/app/core/services/si/si-configuration/si-export-settings.service.spec.ts(1 hunks)src/app/core/services/si/si-configuration/si-import-settings.service.spec.ts(1 hunks)src/app/core/services/si/si-configuration/si-onboarding.service.spec.ts(1 hunks)src/app/core/services/si/si-core/si-dashboard.service.spec.ts(1 hunks)src/app/core/services/si/si-core/si-paginator.service.spec.ts(1 hunks)src/app/core/services/travelperk/travelperk-configuration/travelperk-payment-profile-settings.service.spec.ts(1 hunks)src/app/core/services/xero/xero-configuration/xero-clone-settings.service.spec.ts(1 hunks)src/app/core/services/xero/xero-configuration/xero-onboarding.service.spec.ts(1 hunks)src/app/integrations/bamboo-hr/bamboo-hr.component.spec.ts(1 hunks)src/app/integrations/bamboo-hr/configuration/configuration.component.spec.ts(1 hunks)src/app/integrations/intacct/intacct-main/intacct-dashboard/intacct-dashboard.component.spec.ts(1 hunks)src/app/integrations/intacct/intacct-onboarding/intacct-onboarding-done/intacct-onboarding-done.component.spec.ts(1 hunks)src/app/integrations/landing-v2/landing-v2.component.spec.ts(1 hunks)src/app/integrations/landing/landing.component.spec.ts(1 hunks)src/app/integrations/qbd/qbd-main/qbd-mapping/qbd-generic-mapping/qbd-generic-mapping.component.spec.ts(1 hunks)src/app/integrations/qbo/qbo.fixture.ts(6 hunks)src/app/integrations/travelperk/travelperk.component.spec.ts(1 hunks)src/app/shared/components/configuration/configuration-label/configuration-label.component.spec.ts(1 hunks)src/app/shared/components/configuration/configuration-multi-select/configuration-multi-select.component.spec.ts(1 hunks)src/app/shared/components/configuration/configuration-radio-field/configuration-radio-field.component.spec.ts(1 hunks)src/app/shared/components/configuration/configuration-schedule-export/configuration-schedule-export.component.spec.ts(1 hunks)src/app/shared/components/configuration/configuration-select-field/configuration-select-field.component.spec.ts(1 hunks)src/app/shared/components/configuration/configuration-skip-export/configuration-skip-export.component.spec.ts(1 hunks)src/app/shared/components/configuration/configuration-step-footer/configuration-step-footer.component.spec.ts(1 hunks)src/app/shared/components/configuration/configuration-step-header/configuration-step-header.component.spec.ts(1 hunks)src/app/shared/components/configuration/configuration-step-sub-header/configuration-step-sub-header.component.spec.ts(1 hunks)src/app/shared/components/configuration/configuration-text-field/configuration-text-field.component.spec.ts(1 hunks)src/app/shared/components/configuration/configuration-toggle-field/configuration-toggle-field.component.spec.ts(1 hunks)src/app/shared/components/configuration/email-multi-select-field/email-multi-select-field.component.spec.ts(1 hunks)src/app/shared/components/configuration/preview-dialog/preview-dialog.component.spec.ts(1 hunks)src/app/shared/components/core/badge/badge.component.spec.ts(1 hunks)src/app/shared/components/core/error/error.component.spec.ts(1 hunks)src/app/shared/components/core/loader/loader.component.spec.ts(1 hunks)src/app/shared/components/core/svg-icon/svg-icon.component.spec.ts(1 hunks)src/app/shared/components/dashboard/dashboard-accounting-error-dialog/dashboard-accounting-error-dialog.component.spec.ts(1 hunks)src/app/shared/components/dashboard/dashboard-error-section/dashboard-error-section.component.spec.ts(1 hunks)src/app/shared/components/dashboard/dashboard-export-log-dialog/dashboard-export-log-dialog.component.spec.ts(1 hunks)src/app/shared/components/dashboard/dashboard-export-section/dashboard-export-section.component.spec.ts(1 hunks)src/app/shared/components/dashboard/dashboard-export-summary-section/dashboard-export-summary-section.component.spec.ts(1 hunks)src/app/shared/components/export-log/export-log-dialog/export-log-child-table-dialog.component.spec.ts(1 hunks)src/app/shared/components/export-log/export-log-filter/export-log-filter.component.spec.ts(1 hunks)src/app/shared/components/export-log/export-log-table/export-log-table.component.spec.ts(1 hunks)src/app/shared/components/export-log/skipped-export-log-table/skipped-export-log-table.component.spec.ts(1 hunks)src/app/shared/components/helper/app-landing-page-body/app-landing-page-body.component.spec.ts(1 hunks)src/app/shared/components/helper/app-landing-page-header/app-landing-page-header.component.spec.ts(1 hunks)src/app/shared/components/helper/mandatory-error-message/mandatory-error-message.component.spec.ts(1 hunks)src/app/shared/components/helper/mandatory-field/mandatory-field.component.spec.ts(1 hunks)src/app/shared/components/helper/mapping/generic-mapping-table/generic-mapping-table.component.spec.ts(1 hunks)src/app/shared/components/helper/mapping/generic-mapping-v2/generic-mapping-v2.component.spec.ts(1 hunks)src/app/shared/components/helper/mapping/mapping-card-header/mapping-card-header.component.spec.ts(1 hunks)src/app/shared/components/helper/mapping/mapping-filter/mapping-filter.component.spec.ts(1 hunks)src/app/shared/components/helper/onboarding-done/onboarding-done.component.spec.ts(1 hunks)src/app/shared/components/helper/onboarding-stepper/onboarding-stepper.component.spec.ts(1 hunks)src/app/shared/components/helper/optional-field/optional-field.component.spec.ts(1 hunks)src/app/shared/components/helper/paginator/paginator.component.spec.ts(1 hunks)src/app/shared/components/helper/shimmers/shimmers.component.spec.ts(1 hunks)src/app/shared/components/helper/zero-state-with-illustration/zero-state-with-illustration.component.spec.ts(1 hunks)src/app/shared/components/helper/zero-state/zero-state.component.spec.ts(1 hunks)src/app/shared/components/input/dropdown/dropdown.component.spec.ts(1 hunks)src/app/shared/components/input/multi-select/multi-select.component.spec.ts(1 hunks)src/app/shared/components/input/search/search.component.spec.ts(1 hunks)src/app/shared/components/input/toggle/toggle.component.spec.ts(1 hunks)src/app/shared/components/menu/main-menu/main-menu.component.spec.ts(1 hunks)
⛔ Files not processed due to max files limit (13)
- src/app/shared/components/menu/sub-menu/sub-menu.component.spec.ts
- src/app/shared/components/netsuite/core/netsuite-connector/netsuite-connector.component.spec.ts
- src/app/shared/components/netsuite/core/netsuite-subsidiary-mapping/netsuite-subsidiary-mapping.component.spec.ts
- src/app/shared/components/onboarding/clone-setting/clone-setting-field/clone-setting-field.component.spec.ts
- src/app/shared/components/onboarding/clone-setting/clone-setting-header/clone-setting-header.component.spec.ts
- src/app/shared/components/si/core/intacct-connector/intacct-connector.component.spec.ts
- src/app/shared/components/si/helper/dashboard-intacct-errors/dashboard-intacct-errors.component.spec.ts
- src/app/shared/components/si/helper/dashboard-mapping-resolve/dashboard-mapping-resolve.component.spec.ts
- src/app/shared/components/si/helper/skip-export/skip-export.component.spec.ts
- src/app/shared/pipes/search.pipe.spec.ts
- src/app/shared/pipes/sentence-case.pipe.spec.ts
- src/app/shared/pipes/snake-case-to-space-case.pipe.spec.ts
- src/app/shared/pipes/trim-character.pipe.spec.ts
🧰 Additional context used
📓 Path-based instructions (1)
**/*.component.spec.ts
📄 CodeRabbit inference engine (.cursor/rules/component-creation.mdc)
When generating components, skip creating test files (
--skip-tests); component spec files should not be added
Files:
src/app/integrations/travelperk/travelperk.component.spec.tssrc/app/app.component.spec.tssrc/app/shared/components/dashboard/dashboard-error-section/dashboard-error-section.component.spec.tssrc/app/shared/components/configuration/configuration-skip-export/configuration-skip-export.component.spec.tssrc/app/shared/components/helper/shimmers/shimmers.component.spec.tssrc/app/shared/components/helper/mapping/generic-mapping-v2/generic-mapping-v2.component.spec.tssrc/app/shared/components/export-log/export-log-filter/export-log-filter.component.spec.tssrc/app/shared/components/configuration/configuration-step-sub-header/configuration-step-sub-header.component.spec.tssrc/app/shared/components/configuration/configuration-multi-select/configuration-multi-select.component.spec.tssrc/app/integrations/intacct/intacct-main/intacct-dashboard/intacct-dashboard.component.spec.tssrc/app/shared/components/helper/app-landing-page-header/app-landing-page-header.component.spec.tssrc/app/integrations/bamboo-hr/configuration/configuration.component.spec.tssrc/app/shared/components/helper/mapping/mapping-filter/mapping-filter.component.spec.tssrc/app/shared/components/input/multi-select/multi-select.component.spec.tssrc/app/shared/components/input/dropdown/dropdown.component.spec.tssrc/app/shared/components/helper/mapping/mapping-card-header/mapping-card-header.component.spec.tssrc/app/shared/components/helper/app-landing-page-body/app-landing-page-body.component.spec.tssrc/app/shared/components/helper/onboarding-stepper/onboarding-stepper.component.spec.tssrc/app/shared/components/dashboard/dashboard-export-summary-section/dashboard-export-summary-section.component.spec.tssrc/app/shared/components/dashboard/dashboard-export-log-dialog/dashboard-export-log-dialog.component.spec.tssrc/app/shared/components/core/loader/loader.component.spec.tssrc/app/shared/components/core/svg-icon/svg-icon.component.spec.tssrc/app/shared/components/core/badge/badge.component.spec.tssrc/app/shared/components/export-log/export-log-dialog/export-log-child-table-dialog.component.spec.tssrc/app/shared/components/configuration/email-multi-select-field/email-multi-select-field.component.spec.tssrc/app/shared/components/configuration/configuration-radio-field/configuration-radio-field.component.spec.tssrc/app/shared/components/export-log/export-log-table/export-log-table.component.spec.tssrc/app/shared/components/helper/mapping/generic-mapping-table/generic-mapping-table.component.spec.tssrc/app/shared/components/core/error/error.component.spec.tssrc/app/shared/components/export-log/skipped-export-log-table/skipped-export-log-table.component.spec.tssrc/app/shared/components/helper/onboarding-done/onboarding-done.component.spec.tssrc/app/shared/components/configuration/configuration-step-footer/configuration-step-footer.component.spec.tssrc/app/integrations/landing/landing.component.spec.tssrc/app/integrations/landing-v2/landing-v2.component.spec.tssrc/app/shared/components/configuration/configuration-select-field/configuration-select-field.component.spec.tssrc/app/shared/components/helper/paginator/paginator.component.spec.tssrc/app/shared/components/configuration/configuration-label/configuration-label.component.spec.tssrc/app/shared/components/helper/mandatory-error-message/mandatory-error-message.component.spec.tssrc/app/integrations/bamboo-hr/bamboo-hr.component.spec.tssrc/app/shared/components/dashboard/dashboard-accounting-error-dialog/dashboard-accounting-error-dialog.component.spec.tssrc/app/integrations/intacct/intacct-onboarding/intacct-onboarding-done/intacct-onboarding-done.component.spec.tssrc/app/shared/components/helper/optional-field/optional-field.component.spec.tssrc/app/shared/components/configuration/configuration-step-header/configuration-step-header.component.spec.tssrc/app/shared/components/configuration/preview-dialog/preview-dialog.component.spec.tssrc/app/integrations/qbd/qbd-main/qbd-mapping/qbd-generic-mapping/qbd-generic-mapping.component.spec.tssrc/app/shared/components/configuration/configuration-text-field/configuration-text-field.component.spec.tssrc/app/shared/components/dashboard/dashboard-export-section/dashboard-export-section.component.spec.tssrc/app/shared/components/input/toggle/toggle.component.spec.tssrc/app/shared/components/helper/mandatory-field/mandatory-field.component.spec.tssrc/app/shared/components/configuration/configuration-schedule-export/configuration-schedule-export.component.spec.tssrc/app/shared/components/input/search/search.component.spec.tssrc/app/shared/components/helper/zero-state/zero-state.component.spec.tssrc/app/shared/components/menu/main-menu/main-menu.component.spec.tssrc/app/shared/components/helper/zero-state-with-illustration/zero-state-with-illustration.component.spec.tssrc/app/auth/login/login.component.spec.tssrc/app/shared/components/configuration/configuration-toggle-field/configuration-toggle-field.component.spec.ts
🧠 Learnings (7)
📚 Learning: 2025-10-13T11:34:52.554Z
Learnt from: CR
Repo: fylein/fyle-integrations-app PR: 0
File: .cursor/rules/component-creation.mdc:0-0
Timestamp: 2025-10-13T11:34:52.554Z
Learning: Applies to **/*.component.spec.ts : When generating components, skip creating test files (`--skip-tests`); component spec files should not be added
Applied to files:
src/app/integrations/travelperk/travelperk.component.spec.tssrc/app/app.component.spec.tssrc/app/shared/components/dashboard/dashboard-error-section/dashboard-error-section.component.spec.tssrc/app/shared/components/configuration/configuration-skip-export/configuration-skip-export.component.spec.tssrc/app/shared/components/helper/shimmers/shimmers.component.spec.tssrc/app/shared/components/helper/mapping/generic-mapping-v2/generic-mapping-v2.component.spec.tssrc/app/shared/components/export-log/export-log-filter/export-log-filter.component.spec.tssrc/app/shared/components/configuration/configuration-step-sub-header/configuration-step-sub-header.component.spec.tssrc/app/shared/components/configuration/configuration-multi-select/configuration-multi-select.component.spec.tssrc/app/shared/components/helper/app-landing-page-header/app-landing-page-header.component.spec.tssrc/app/integrations/bamboo-hr/configuration/configuration.component.spec.tssrc/app/shared/components/helper/mapping/mapping-filter/mapping-filter.component.spec.tssrc/app/shared/components/input/multi-select/multi-select.component.spec.tssrc/app/shared/components/input/dropdown/dropdown.component.spec.tssrc/app/shared/components/helper/mapping/mapping-card-header/mapping-card-header.component.spec.tssrc/app/shared/components/helper/app-landing-page-body/app-landing-page-body.component.spec.tssrc/app/shared/components/helper/onboarding-stepper/onboarding-stepper.component.spec.tssrc/app/shared/components/dashboard/dashboard-export-summary-section/dashboard-export-summary-section.component.spec.tssrc/app/shared/components/dashboard/dashboard-export-log-dialog/dashboard-export-log-dialog.component.spec.tssrc/app/shared/components/core/loader/loader.component.spec.tssrc/app/shared/components/core/svg-icon/svg-icon.component.spec.tssrc/app/shared/components/core/badge/badge.component.spec.tssrc/app/shared/components/export-log/export-log-dialog/export-log-child-table-dialog.component.spec.tssrc/app/shared/components/configuration/email-multi-select-field/email-multi-select-field.component.spec.tssrc/app/shared/components/configuration/configuration-radio-field/configuration-radio-field.component.spec.tssrc/app/shared/components/export-log/export-log-table/export-log-table.component.spec.tssrc/app/shared/components/helper/mapping/generic-mapping-table/generic-mapping-table.component.spec.tssrc/app/shared/components/core/error/error.component.spec.tssrc/app/core/services/common/configuration.service.spec.tssrc/app/shared/components/export-log/skipped-export-log-table/skipped-export-log-table.component.spec.tssrc/app/shared/components/helper/onboarding-done/onboarding-done.component.spec.tssrc/app/shared/components/configuration/configuration-step-footer/configuration-step-footer.component.spec.tssrc/app/integrations/landing/landing.component.spec.tssrc/app/integrations/landing-v2/landing-v2.component.spec.tssrc/app/shared/components/configuration/configuration-select-field/configuration-select-field.component.spec.tssrc/app/shared/components/helper/paginator/paginator.component.spec.tssrc/app/shared/components/configuration/configuration-label/configuration-label.component.spec.tssrc/app/shared/components/helper/mandatory-error-message/mandatory-error-message.component.spec.tssrc/app/integrations/bamboo-hr/bamboo-hr.component.spec.tssrc/app/shared/components/dashboard/dashboard-accounting-error-dialog/dashboard-accounting-error-dialog.component.spec.tssrc/app/integrations/intacct/intacct-onboarding/intacct-onboarding-done/intacct-onboarding-done.component.spec.tssrc/app/shared/components/helper/optional-field/optional-field.component.spec.tssrc/app/shared/components/configuration/configuration-step-header/configuration-step-header.component.spec.tssrc/app/shared/components/configuration/preview-dialog/preview-dialog.component.spec.tssrc/app/integrations/qbd/qbd-main/qbd-mapping/qbd-generic-mapping/qbd-generic-mapping.component.spec.tssrc/app/shared/components/configuration/configuration-text-field/configuration-text-field.component.spec.tssrc/app/shared/components/dashboard/dashboard-export-section/dashboard-export-section.component.spec.tssrc/app/shared/components/input/toggle/toggle.component.spec.tssrc/app/shared/components/helper/mandatory-field/mandatory-field.component.spec.tssrc/app/shared/components/configuration/configuration-schedule-export/configuration-schedule-export.component.spec.tssrc/app/shared/components/input/search/search.component.spec.tssrc/app/shared/components/helper/zero-state/zero-state.component.spec.tssrc/app/shared/components/menu/main-menu/main-menu.component.spec.tssrc/app/shared/components/helper/zero-state-with-illustration/zero-state-with-illustration.component.spec.tssrc/app/auth/login/login.component.spec.tssrc/app/shared/components/configuration/configuration-toggle-field/configuration-toggle-field.component.spec.ts
📚 Learning: 2025-07-28T07:37:26.776Z
Learnt from: CR
Repo: fylein/fyle-integrations-app PR: 0
File: .cursor/rules/component-i18n-key-naming.mdc:0-0
Timestamp: 2025-07-28T07:37:26.776Z
Learning: Applies to **/*.component.{ts,html} : Do not use prefixes like 'ui', 'feature', or 'component' in the top-level i18n object name; the object name should be the context.
Applied to files:
src/app/shared/components/configuration/configuration-multi-select/configuration-multi-select.component.spec.tssrc/app/shared/components/configuration/configuration-text-field/configuration-text-field.component.spec.ts
📚 Learning: 2024-10-08T15:51:28.972Z
Learnt from: anishfyle
Repo: fylein/fyle-integrations-app PR: 367
File: src/app/core/models/sage300/db/sage300-accounting-export.model.ts:10-14
Timestamp: 2024-10-08T15:51:28.972Z
Learning: The user agreed with the suggestion to remove an unused import statement for `BusinessCentralAccountingExport` after the type was no longer used in the `Sage300AccountingExportResponse` interface.
Applied to files:
src/app/integrations/intacct/intacct-main/intacct-dashboard/intacct-dashboard.component.spec.tssrc/app/core/services/sage50/sage50-configuration/sage50-import-attributes.service.spec.ts
📚 Learning: 2024-06-10T19:13:15.470Z
Learnt from: ashwin1111
Repo: fylein/fyle-integrations-app PR: 343
File: src/app/integrations/business-central/business-central-shared/business-central-export-settings/business-central-export-settings.component.html:0-0
Timestamp: 2024-06-10T19:13:15.470Z
Learning: The user ashwin1111 has confirmed the replacement of the 'intacct' keyword with the variable `targetSystemName` for dynamic system naming in the `business-central-export-settings.component.html` file.
Applied to files:
src/app/integrations/intacct/intacct-main/intacct-dashboard/intacct-dashboard.component.spec.ts
📚 Learning: 2025-07-28T07:37:10.809Z
Learnt from: CR
Repo: fylein/fyle-integrations-app PR: 0
File: .cursor/rules/atomics-i18n-key-pattern.mdc:0-0
Timestamp: 2025-07-28T07:37:10.809Z
Learning: Applies to **/*.{service,pipe,directive}.ts : Convert kebab-case file names to camelCase and remove the suffixes 'Service', 'Pipe', or 'Directive' when generating i18n keys from file names (e.g., 'report-expenses.service.ts' → 'reportExpenses')
Applied to files:
src/app/core/services/si/si-configuration/si-export-settings.service.spec.tssrc/app/core/services/common/csv-json-translator.service.spec.ts
📚 Learning: 2025-07-28T07:37:26.776Z
Learnt from: CR
Repo: fylein/fyle-integrations-app PR: 0
File: .cursor/rules/component-i18n-key-naming.mdc:0-0
Timestamp: 2025-07-28T07:37:26.776Z
Learning: Applies to **/*.component.{ts,html} : Top-level object in i18n files must be the component or feature folder name, converted from the file name by removing the prefixes 'feature', 'ui', or 'component' (in that order) and converting from kebab-case to camelCase.
Applied to files:
src/app/shared/components/configuration/configuration-step-footer/configuration-step-footer.component.spec.tssrc/app/shared/components/configuration/configuration-select-field/configuration-select-field.component.spec.ts
📚 Learning: 2025-10-13T11:34:52.554Z
Learnt from: CR
Repo: fylein/fyle-integrations-app PR: 0
File: .cursor/rules/component-creation.mdc:0-0
Timestamp: 2025-10-13T11:34:52.554Z
Learning: Applies to **/*.component.ts : Always create Angular standalone components (`--standalone=true`), i.e., components must declare `standalone: true` in `Component` metadata
Applied to files:
src/app/shared/components/configuration/configuration-toggle-field/configuration-toggle-field.component.spec.ts
|
|
||
| describe('UxeroUcloneUsettingsService', () => { | ||
| let service: UxeroUcloneUsettingsService; | ||
| describe('XeroCloneSettingsServicee', () => { |
There was a problem hiding this comment.
Fix typo in describe block.
The describe block has an extra 'e' at the end: 'XeroCloneSettingsServicee' should be 'XeroCloneSettingsService'.
Apply this diff to fix the typo:
-describe('XeroCloneSettingsServicee', () => {
+describe('XeroCloneSettingsService', () => {📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| describe('XeroCloneSettingsServicee', () => { | |
| describe('XeroCloneSettingsService', () => { |
🤖 Prompt for AI Agents
In
src/app/core/services/xero/xero-configuration/xero-clone-settings.service.spec.ts
around line 6, the describe block title contains a typo
'XeroCloneSettingsServicee'; update the string to 'XeroCloneSettingsService' so
the describe block reads correctly.
| import { Router } from '@angular/router'; | ||
|
|
||
| xdescribe('OnboardingDoneComponent', () => { | ||
| describe('OnboardingDoneComponent', () => { |
There was a problem hiding this comment.
Correct the describe block name to match the component.
The describe block label is 'OnboardingDoneComponent', but the actual component class is 'IntacctOnboardingDoneComponent'. Update the label for consistency and clarity.
Apply this diff:
-describe('OnboardingDoneComponent', () => {
+describe('IntacctOnboardingDoneComponent', () => {📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| describe('OnboardingDoneComponent', () => { | |
| describe('IntacctOnboardingDoneComponent', () => { |
🤖 Prompt for AI Agents
In
src/app/integrations/intacct/intacct-onboarding/intacct-onboarding-done/intacct-onboarding-done.component.spec.ts
around line 6, the describe block label currently reads
'OnboardingDoneComponent' but the actual component class is
IntacctOnboardingDoneComponent; update the string in the describe(...) call to
'IntacctOnboardingDoneComponent' so the test suite label matches the component
name for clarity and consistency.
| import { MandatoryErrorMessageComponent } from './mandatory-error-message.component'; | ||
|
|
||
| xdescribe('MandatoryErrorMessageComponent', () => { | ||
| describe('MandatoryErrorMessageComponent', () => { |
There was a problem hiding this comment.
🛠️ Refactor suggestion | 🟠 Major
🧩 Analysis chain
Verify that the enabled test suite passes.
Good to enable this previously skipped test suite. Ensure all test cases pass successfully.
🏁 Script executed:
#!/bin/bash
# Description: Run the test suite to verify all tests pass
# Execute the specific test file
npx ng test --include='**/mandatory-error-message.component.spec.ts' --watch=falseLength of output: 164
🏁 Script executed:
#!/bin/bash
# Display the test file content to verify structure and identify issues
cat "src/app/shared/components/helper/mandatory-error-message/mandatory-error-message.component.spec.ts"Length of output: 2419
🏁 Script executed:
#!/bin/bash
# Check if the component file exists
if [ -f "src/app/shared/components/helper/mandatory-error-message/mandatory-error-message.component.ts" ]; then
echo "=== Component file exists ==="
head -20 "src/app/shared/components/helper/mandatory-error-message/mandatory-error-message.component.ts"
else
echo "Component file not found"
fiLength of output: 710
🏁 Script executed:
#!/bin/bash
# Check for any other test configuration or setup files
find "src/app/shared/components/helper/mandatory-error-message/" -type fLength of output: 384
🏁 Script executed:
#!/bin/bash
# Check coding guidelines applicability - verify if this is a newly generated component
git log --oneline --all -- "src/app/shared/components/helper/mandatory-error-message/mandatory-error-message.component.spec.ts" | head -5Length of output: 114
🏁 Script executed:
#!/bin/bash
# Verify the PR changes - check git diff for this file
git diff HEAD~1 -- "src/app/shared/components/helper/mandatory-error-message/mandatory-error-message.component.spec.ts" 2>/dev/null || echo "No git history available or file unchanged in current branch"Length of output: 832
🏁 Script executed:
#!/bin/bash
# Check if there's a package.json and what test runner is configured
if [ -f "package.json" ]; then
echo "=== Test scripts in package.json ==="
jq '.scripts | select(. != null) | to_entries[] | select(.key | contains("test")) | "\(.key): \(.value)"' package.json 2>/dev/null || grep -A5 '"test"' package.json || echo "Unable to parse test scripts"
fiLength of output: 169
🏁 Script executed:
#!/bin/bash
# Alternative: Check if the component exists using find
fd "mandatory-error-message" --type fLength of output: 384
🏁 Script executed:
#!/bin/bash
# Look for the component spec file anywhere in the project
fd "mandatory-error-message.component.spec.ts" --type fLength of output: 98
🏁 Script executed:
#!/bin/bash
# Check git status and recent changes
git status --short 2>/dev/null || echo "No git available"Length of output: 13
🏁 Script executed:
#!/bin/bash
# Try to find where tests would be run from
ls -la karma.conf.js angular.json tsconfig.json 2>/dev/null || echo "Test config files not found in root"Length of output: 187
Fix test naming and typos before enabling this test suite.
The change from xdescribe to describe on line 6 correctly enables the test suite. However, the test file contains quality issues that should be addressed:
- Lines 25 and 35: Duplicate test names ("listName input with a consonent check"). Line 35 tests multi-word input, so rename it for clarity (e.g., "listName input with multi-word consonant check").
- Line 25: Typo in test name: "consonent" → "consonant"
- Line 56: Typo in test data: "meaningfull" → "meaningful"
🤖 Prompt for AI Agents
In
src/app/shared/components/helper/mandatory-error-message/mandatory-error-message.component.spec.ts
(around lines 6, 25, 35, 56), fix test names and typos: change the
duplicate/incorrect test name on line 25 from "listName input with a consonent
check" to "listName input with a consonant check", rename the duplicate test on
line 35 to "listName input with multi-word consonant check" to reflect its
purpose, and correct the test data typo on line 56 from "meaningfull" to
"meaningful". Ensure the updated names are unique and accurately describe each
test before re-enabling the suite.
| import { SearchComponent } from './search.component'; | ||
|
|
||
| xdescribe('SearchComponent', () => { | ||
| describe('SearchComponent', () => { |
There was a problem hiding this comment.
🧩 Analysis chain
Verify test passes with current minimal setup.
The test suite is being re-enabled, which aligns with the PR objective. However, the test configuration is minimal with no module imports or dependency mocks. If SearchComponent requires FormsModule, ReactiveFormsModule, or has input/output bindings or service dependencies, the test may fail.
Run the following command to verify the test passes:
Note on coding guidelines: The guideline about skipping component spec files applies to new component generation (--skip-tests flag), not to re-enabling existing test suites. Based on learnings.
🏁 Script executed:
#!/bin/bash
# Verify the SearchComponent test passes and check for missing dependencies
# Run the specific test file
npm test -- --include='**/search.component.spec.ts' 2>&1 || true
# Check SearchComponent implementation for dependencies
cat src/app/shared/components/input/search/search.component.tsLength of output: 1917
I need to see the full test file to verify if the dependencies are properly configured:
I need to see the full test file to verify if the FormGroup and required controls are properly set up. Let me search for the complete test file:
Let me check the actual test file directly from the repository:
---
🏁 Script executed:
```shell
#!/bin/bash
# Read the full test file to verify setup
cat src/app/shared/components/input/search/search.component.spec.ts
Length of output: 598
Test will fail when enabled due to missing FormGroup initialization.
The SearchComponent requires a FormGroup to be provided as an @Input() and immediately uses it in ngOnInit() via searchQueryWatcher(), which accesses this.form.controls.searchOption.valueChanges. The current test setup:
- Does not import
ReactiveFormsModule - Does not create a
FormGroup - Calls
fixture.detectChanges()immediately, triggeringngOnInit()on an uninitialized component
This will result in: "Cannot read property 'controls' of undefined"
Required fix:
Before fixture.detectChanges(), add:
const formGroup = new FormGroup({ searchOption: new FormControl('') });
component.form = formGroup;And import ReactiveFormsModule in TestBed.configureTestingModule.
🤖 Prompt for AI Agents
In src/app/shared/components/input/search/search.component.spec.ts around line
5, the test calls fixture.detectChanges() while the component expects an
@Input() FormGroup and uses it in ngOnInit(), causing "Cannot read property
'controls' of undefined"; fix by importing ReactiveFormsModule into
TestBed.configureTestingModule imports and, before fixture.detectChanges(),
create a FormGroup with a searchOption FormControl (e.g. new FormGroup({
searchOption: new FormControl('') })) and assign it to component.form so
ngOnInit() has a valid form to work with.
Description
fix: unit test fix
Clickup
hrrps://app.clickup.com
Summary by CodeRabbit
Tests
Bug Fixes
Chores