Enhancement: display current ASN in statistics (#6692)

This commit is contained in:
Daniel
2024-05-13 01:58:04 +02:00
committed by GitHub
parent 6fa3522618
commit 52350f8b51
5 changed files with 60 additions and 5 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:'
)
})
})