feat[dashboard]: show current ASN in dashboard statistics

This commit is contained in:
darmiel
2024-05-12 20:19:32 +02:00
committed by Daniel
parent 6fa3522618
commit 0e4673b1e2
4 changed files with 48 additions and 0 deletions

View File

@@ -189,4 +189,38 @@ describe('StatisticsWidgetComponent', () => {
'Other(0.9%)'
)
})
it('should display the current ASN', () => {
const mockStats = {
current_asn: 122,
}
const req = httpTestingController.expectOne(
`${environment.apiBaseUrl}statistics/`
)
req.flush(mockStats)
fixture.detectChanges()
expect(fixture.nativeElement.textContent.replace(/\s/g, '')).toContain(
'CurrentASN:122'
)
})
it('should not display the current ASN if it is not available', () => {
const mockStats = {
current_asn: 0,
}
const req = httpTestingController.expectOne(
`${environment.apiBaseUrl}statistics/`
)
req.flush(mockStats)
fixture.detectChanges()
expect(fixture.nativeElement.textContent.replace(/\s/g, '')).not.toContain(
'CurrentASN:'
)
})
})