mirror of https://github.com/ghostfolio/ghostfolio
Browse Source
* feat(lib): resolve ts errors * feat(lib): make days protected and readonly * feat(lib): create formatDay helper function * fix(lib): remove unused eslint-disable * feat(lib): change locale to input signal * feat(lib): change defaultDateFormat to computed signal * feat(lib): change deviceType to computed signal * feat(lib): change marketData to input signal * feat(lib): change historicalDataItems to computed signal * feat(nx): run ui test * feat(lib): update days to improve readability * feat(nx): revert test changes * fix(lib): change logic for locale * fix(lib): disable mutating the injected readonly data * fix(lib): implement takeUntilDestroyed * fix(lib): implement takeUntilDestroyed * fix(lib): organize importspull/6342/head
committed by
GitHub
6 changed files with 172 additions and 97 deletions
@ -0,0 +1,60 @@ |
|||
import { DataService } from '@ghostfolio/ui/services'; |
|||
|
|||
import { signal } from '@angular/core'; |
|||
import { ComponentFixture, TestBed } from '@angular/core/testing'; |
|||
import { FormBuilder } from '@angular/forms'; |
|||
import { MatDialog } from '@angular/material/dialog'; |
|||
import { MatSnackBar } from '@angular/material/snack-bar'; |
|||
import { DeviceDetectorService } from 'ngx-device-detector'; |
|||
|
|||
import { GfHistoricalMarketDataEditorComponent } from './historical-market-data-editor.component'; |
|||
|
|||
jest.mock( |
|||
'./historical-market-data-editor-dialog/historical-market-data-editor-dialog.component', |
|||
() => ({ |
|||
GfHistoricalMarketDataEditorDialogComponent: class {} |
|||
}) |
|||
); |
|||
|
|||
describe('GfHistoricalMarketDataEditorComponent', () => { |
|||
let component: GfHistoricalMarketDataEditorComponent; |
|||
let fixture: ComponentFixture<GfHistoricalMarketDataEditorComponent>; |
|||
|
|||
beforeEach(async () => { |
|||
await TestBed.configureTestingModule({ |
|||
imports: [GfHistoricalMarketDataEditorComponent], |
|||
providers: [ |
|||
FormBuilder, |
|||
{ provide: DataService, useValue: {} }, |
|||
{ |
|||
provide: DeviceDetectorService, |
|||
useValue: { |
|||
deviceInfo: signal({ deviceType: 'desktop' }) |
|||
} |
|||
}, |
|||
{ provide: MatDialog, useValue: {} }, |
|||
{ provide: MatSnackBar, useValue: {} } |
|||
] |
|||
}).compileComponents(); |
|||
|
|||
fixture = TestBed.createComponent(GfHistoricalMarketDataEditorComponent); |
|||
component = fixture.componentInstance; |
|||
fixture.detectChanges(); |
|||
}); |
|||
|
|||
it('should create', () => { |
|||
expect(component).toBeTruthy(); |
|||
}); |
|||
|
|||
describe('formatDay', () => { |
|||
it('should pad single digit days with zero', () => { |
|||
expect(component.formatDay(1)).toBe('01'); |
|||
expect(component.formatDay(9)).toBe('09'); |
|||
}); |
|||
|
|||
it('should not pad double digit days', () => { |
|||
expect(component.formatDay(10)).toBe('10'); |
|||
expect(component.formatDay(31)).toBe('31'); |
|||
}); |
|||
}); |
|||
}); |
|||
Loading…
Reference in new issue