-
Notifications
You must be signed in to change notification settings - Fork 0
test: intacct c1 import settings watchers #1020
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: intacct c1 import settings watchers #1020
Conversation
WalkthroughThe pull request introduces enhancements to the test suite for the Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (2)
src/app/integrations/intacct/intacct.fixture.ts (1)
934-940: LGTM: NewblankMappingconstant added.The
blankMappingconstant provides a useful template for creating new mapping settings. All fields are initialized with appropriate default values.Consider if setting
import_to_fyle: trueby default is the desired behavior for all use cases. If not, you might want to set it tofalseor make it a parameter that can be passed when using this constant.src/app/integrations/intacct/intacct-shared/intacct-c1-import-settings/intacct-c1-import-settings.component.spec.ts (1)
238-238: Avoid Accessing Private Methods in TestsIn lines 238 and 281-282, private methods are accessed using bracket notation (e.g.,
component['createFormGroup']). Accessing private methods directly can break encapsulation and lead to brittle tests. Consider testing through public methods or refactoring to expose necessary functionality in a testable manner.Also applies to: 281-282
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
- src/app/integrations/intacct/intacct-shared/intacct-c1-import-settings/intacct-c1-import-settings.component.spec.ts (4 hunks)
- src/app/integrations/intacct/intacct.fixture.ts (2 hunks)
🧰 Additional context used
🔇 Additional comments (10)
src/app/integrations/intacct/intacct.fixture.ts (1)
12-12: LGTM: Import statement updated correctly.The import statement has been updated to include
MappingSettingfrom the import settings model. This change is necessary to support the newblankMappingconstant added at the end of the file.src/app/integrations/intacct/intacct-shared/intacct-c1-import-settings/intacct-c1-import-settings.component.spec.ts (9)
5-5: Appropriate Import of 'throwError'The addition of
throwErrorfrom'rxjs'is necessary for simulating error conditions in your test cases.
24-25: Added Necessary Test FixturesImporting
expenseFieldsExpectedForC1andblankMappingfrom'../../intacct.fixture'provides essential data for the new test scenarios.
28-28: Import of Model Interfaces is AppropriateIncluding
ImportSettingGet,ImportSettingPost, andImportSettingsimports enhances type safety and clarity in the test cases.
31-31: Importing Required Enums for TestsThe import of enums like
IntacctOnboardingState,IntacctUpdateEvent,Page,ProgressPhase,ToastSeverity, andTrackingAppis appropriate and necessary for the new tests.
54-54: Updated Spy Object for 'SiImportSettingService'Adding
'postImportSettings'to the spy object methods is necessary for testing the save functionality of the component.
58-58: Updated Spy Object for 'TrackingService'Including
'intacctUpdateEvent'and'integrationsOnboardingCompletion'in the spy object allows you to effectively test tracking of user interactions.
59-59: Updated Spy Object for 'SiWorkspaceService'Adding
'setIntacctOnboardingState'to the spy object methods facilitates testing of state changes during the onboarding process.
173-226: Comprehensive Tests for the 'Save' MethodThe new tests in the
'Save'describe block effectively cover key scenarios:
- Handling post-onboarding state
- Handling onboarding state
- Handling save errors
These tests verify service calls, navigation, tracking events, and error handling, contributing to robust test coverage.
228-328: Effective Tests for Form Control WatchersThe tests within the
'Watchers'describe block thoroughly verify the behavior of form control watchers, ensuring dependent fields respond correctly to state changes and user input.
| /* eslint-disable dot-notation */ | ||
| import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
| import { FormArray, FormBuilder, ReactiveFormsModule } from '@angular/forms'; | ||
| import { FormArray, FormBuilder, FormGroup, ReactiveFormsModule } from '@angular/forms'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Limit the Scope of ESLint Disables
The /* eslint-disable dot-notation */ directive disables the dot-notation rule for the entire file. Consider limiting its scope to only the necessary lines to avoid suppressing linting for unrelated code. This helps maintain code quality by ensuring that other parts of the file still adhere to linting rules.
Clickup
https://app.clickup.com/t/86cwqhb69
Summary by CodeRabbit
New Features
blankMappingconstant for default mapping settings.Bug Fixes
Documentation