@@ -28,10 +28,8 @@ describe('CryptoIcon', () => {
2828 render ( < CryptoIcon ledgerId = "bitcoin" ticker = "BTC" /> ) ;
2929
3030 await waitFor ( ( ) => {
31- expect ( screen . getByRole ( 'img' ) ) . toBeInTheDocument ( ) ;
31+ expect ( screen . getByRole ( 'img' ) ) . toHaveAttribute ( 'src' , ` ${ CRYPTO_ICONS_CDN_BASE } /BTC.png` ) ;
3232 } ) ;
33-
34- expect ( screen . getByRole ( 'img' ) ) . toHaveAttribute ( 'src' , `${ CRYPTO_ICONS_CDN_BASE } /BTC.png` ) ;
3533 } ) ;
3634 } ) ;
3735
@@ -46,26 +44,22 @@ describe('CryptoIcon', () => {
4644 render ( < CryptoIcon ledgerId = "bitcoin" ticker = "BTC" /> ) ;
4745
4846 await waitFor ( ( ) => {
49- expect ( screen . getByRole ( 'img' ) ) . toBeInTheDocument ( ) ;
47+ expect ( screen . getByRole ( 'img' ) ) . toHaveAttribute (
48+ 'src' ,
49+ coinGeckoMock ?. find ( ( i ) => i . ledgerId === 'bitcoin' ) ?. data . img
50+ ) ;
5051 } ) ;
51-
52- expect ( screen . getByRole ( 'img' ) ) . toHaveAttribute (
53- 'src' ,
54- coinGeckoMock ?. find ( ( i ) => i . ledgerId === 'bitcoin' ) ?. data . img
55- ) ;
5652 } ) ;
5753
5854 it ( 'renders CoinGecko icon when ledgerId not in CDN' , async ( ) => {
5955 render ( < CryptoIcon ledgerId = "decred" ticker = "DCR" /> ) ;
6056
6157 await waitFor ( ( ) => {
62- expect ( screen . getByRole ( 'img' ) ) . toBeInTheDocument ( ) ;
58+ expect ( screen . getByRole ( 'img' ) ) . toHaveAttribute (
59+ 'src' ,
60+ coinGeckoMock ?. find ( ( i ) => i . ledgerId === 'decred' ) ?. data . img
61+ ) ;
6362 } ) ;
64-
65- expect ( screen . getByRole ( 'img' ) ) . toHaveAttribute (
66- 'src' ,
67- coinGeckoMock ?. find ( ( i ) => i . ledgerId === 'decred' ) ?. data . img
68- ) ;
6963 } ) ;
7064 } ) ;
7165
@@ -83,10 +77,8 @@ describe('CryptoIcon', () => {
8377 render ( < CryptoIcon ledgerId = "bitcoin" ticker = "BTC" /> ) ;
8478
8579 await waitFor ( ( ) => {
86- expect ( screen . getByRole ( 'img' ) ) . toBeInTheDocument ( ) ;
80+ expect ( screen . getByRole ( 'img' ) ) . toHaveTextContent ( 'B' ) ;
8781 } ) ;
88-
89- expect ( screen . getByRole ( 'img' ) ) . toHaveTextContent ( 'B' ) ;
9082 } ) ;
9183
9284 it ( 'renders ? when ticker is empty' , async ( ) => {
@@ -102,10 +94,8 @@ describe('CryptoIcon', () => {
10294 render ( < CryptoIcon ledgerId = "bitcoin" ticker = "" /> ) ;
10395
10496 await waitFor ( ( ) => {
105- expect ( screen . getByRole ( 'img' ) ) . toBeInTheDocument ( ) ;
97+ expect ( screen . getByRole ( 'img' ) ) . toHaveTextContent ( '?' ) ;
10698 } ) ;
107-
108- expect ( screen . getByRole ( 'img' ) ) . toHaveTextContent ( '?' ) ;
10999 } ) ;
110100 } ) ;
111101
0 commit comments