-
Notifications
You must be signed in to change notification settings - Fork 15
fix: Deprecate simplify report settings #3772
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
base: master
Are you sure you want to change the base?
Changes from 4 commits
b6f7f28
994bfa1
756a390
e09110e
f742c4f
9491a8e
94da9fb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -34,6 +34,7 @@ import { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| taxSettingsData2, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| orgSettingsParamsWithAdvanceWallet, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| orgSettingsWithProjectCategoryRestrictions, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| orgSettingsParamsWithSimplifiedReport, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } from 'src/app/core/mock-data/org-settings.data'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| employeeSettingsData, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -1978,5 +1979,20 @@ export function TestCases5(getTestBed) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| done(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| describe('checkNewReportsFlow():', () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| it('should check for new reports flow, if simplified report closure setting is not enabled', () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| component.checkNewReportsFlow(orgSettings$); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| tick(500); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(orgSettingsService.get).toHaveBeenCalledTimes(1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| it('should check for new reports flow, if simplified report closure setting is enabled', () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| orgSettingsService.get.and.returnValue(of(orgSettingsParamsWithSimplifiedReport)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| component.checkNewReportsFlow(orgSettings$); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| tick(500); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(orgSettingsService.get).toHaveBeenCalledTimes(1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| describe('checkNewReportsFlow():', () => { | |
| it('should check for new reports flow, if simplified report closure setting is not enabled', () => { | |
| component.checkNewReportsFlow(orgSettings$); | |
| tick(500); | |
| expect(orgSettingsService.get).toHaveBeenCalledTimes(1); | |
| }); | |
| it('should check for new reports flow, if simplified report closure setting is enabled', () => { | |
| orgSettingsService.get.and.returnValue(of(orgSettingsParamsWithSimplifiedReport)); | |
| component.checkNewReportsFlow(orgSettings$); | |
| tick(500); | |
| expect(orgSettingsService.get).toHaveBeenCalledTimes(1); | |
| }); | |
| }); | |
| describe('checkNewReportsFlow():', () => { | |
| it('should check for new reports flow, if simplified report closure setting is not enabled', fakeAsync(() => { | |
| const orgSettings$ = of(orgSettingsData); | |
| orgSettingsService.get.and.returnValue(orgSettings$); | |
| component.checkNewReportsFlow(orgSettings$); | |
| tick(500); | |
| expect(orgSettingsService.get).toHaveBeenCalledTimes(1); | |
| })); | |
| it('should check for new reports flow, if simplified report closure setting is enabled', fakeAsync(() => { | |
| const orgSettings$ = of(orgSettingsParamsWithSimplifiedReport); | |
| orgSettingsService.get.and.returnValue(orgSettings$); | |
| component.checkNewReportsFlow(orgSettings$); | |
| tick(500); | |
| expect(orgSettingsService.get).toHaveBeenCalledTimes(1); | |
| })); | |
| }); |
🤖 Prompt for AI Agents
In src/app/fyle/add-edit-expense/add-edit-expense-5.spec.ts around lines 1983 to
1996, the tests for checkNewReportsFlow are missing the fakeAsync wrapper needed
for tick(500), and the orgSettings$ observable is not defined. Wrap the test
functions in fakeAsync, define orgSettings$ as an observable of the appropriate
org settings data, and enhance assertions to verify the actual behavior of
checkNewReportsFlow beyond just service call counts. Additionally, remove any
references to the obsolete isNewReportsFlowEnabled property around line 1582 to
resolve the pipeline failure.
Outdated
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.
Add fakeAsync wrapper for proper async testing, superstar!
Boss, these test cases are using tick(500) but missing the fakeAsync wrapper, which is required for testing asynchronous behavior in Angular. Without this, the tests won't work properly.
- describe('checkNewReportsFlow():', () => {
- it('should check for new reports flow, if simplified report closure setting is not enabled', () => {
+ describe('checkNewReportsFlow():', () => {
+ it('should check for new reports flow, if simplified report closure setting is not enabled', fakeAsync(() => {
component.checkNewReportsFlow(orgSettings$);
tick(500);
expect(orgSettingsService.get).toHaveBeenCalledTimes(1);
- });
+ }));
- it('should check for new reports flow, if simplified report closure setting is enabled', () => {
+ it('should check for new reports flow, if simplified report closure setting is enabled', fakeAsync(() => {
orgSettingsService.get.and.returnValue(of(orgSettingsParamsWithSimplifiedReport));
component.checkNewReportsFlow(orgSettings$);
tick(500);
expect(orgSettingsService.get).toHaveBeenCalledTimes(1);
- });
+ }));📝 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('checkNewReportsFlow():', () => { | |
| it('should check for new reports flow, if simplified report closure setting is not enabled', () => { | |
| component.checkNewReportsFlow(orgSettings$); | |
| tick(500); | |
| expect(orgSettingsService.get).toHaveBeenCalledTimes(1); | |
| }); | |
| it('should check for new reports flow, if simplified report closure setting is enabled', () => { | |
| orgSettingsService.get.and.returnValue(of(orgSettingsParamsWithSimplifiedReport)); | |
| component.checkNewReportsFlow(orgSettings$); | |
| tick(500); | |
| expect(orgSettingsService.get).toHaveBeenCalledTimes(1); | |
| }); | |
| }); | |
| describe('checkNewReportsFlow():', () => { | |
| it('should check for new reports flow, if simplified report closure setting is not enabled', fakeAsync(() => { | |
| component.checkNewReportsFlow(orgSettings$); | |
| tick(500); | |
| expect(orgSettingsService.get).toHaveBeenCalledTimes(1); | |
| })); | |
| it('should check for new reports flow, if simplified report closure setting is enabled', fakeAsync(() => { | |
| orgSettingsService.get.and.returnValue(of(orgSettingsParamsWithSimplifiedReport)); | |
| component.checkNewReportsFlow(orgSettings$); | |
| tick(500); | |
| expect(orgSettingsService.get).toHaveBeenCalledTimes(1); | |
| })); | |
| }); |
🤖 Prompt for AI Agents
In src/app/fyle/add-edit-expense/add-edit-expense-5.spec.ts around lines 1983 to
1996, the test cases use tick(500) for async timing but lack the required
fakeAsync wrapper. To fix this, wrap each it block's callback function with
fakeAsync to properly handle asynchronous operations in Angular tests, ensuring
tick works as intended.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,7 +16,8 @@ export class AddTxnToReportDialogComponent implements OnInit { | |
|
|
||
| constructor( | ||
| private currencyService: CurrencyService, | ||
| @Inject(MAT_BOTTOM_SHEET_DATA) public data: { openReports: Report[]; isNewReportsFlowEnabled: boolean }, | ||
| @Inject(MAT_BOTTOM_SHEET_DATA) public data: { openReports: Report[] }, | ||
|
|
||
|
Comment on lines
+19
to
+20
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Duplicated source of truth for You accept Option 1 – lean on DI only: - @Input() openReports;
+ // @Input() openReports; // removed, DI rulesOption 2 – keep the input but rename one of them to avoid clashes. Pick one path, walk in style.
🤖 Prompt for AI Agents |
||
| private matBottomsheet: MatBottomSheet, | ||
| private router: Router | ||
| ) {} | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.