2023-02-16 20:23:29 +01:00
|
|
|
import { getNftImageAlt } from './nfts';
|
2023-01-25 15:08:35 +01:00
|
|
|
|
2023-02-16 20:23:29 +01:00
|
|
|
describe('NFTs Utils', () => {
|
|
|
|
describe('getNftImageAlt', () => {
|
2023-01-25 15:08:35 +01:00
|
|
|
it('returns the description attribute when it is available', () => {
|
|
|
|
expect(
|
2023-02-16 20:23:29 +01:00
|
|
|
getNftImageAlt({
|
2023-01-25 15:08:35 +01:00
|
|
|
name: 'Cool NFT',
|
|
|
|
tokenId: '555',
|
|
|
|
description: 'This is a really cool NFT',
|
|
|
|
}),
|
|
|
|
).toBe('This is a really cool NFT');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('returns the formatted name and tokenId attributes when a description is not present', () => {
|
|
|
|
expect(
|
2023-02-16 20:23:29 +01:00
|
|
|
getNftImageAlt({
|
2023-01-25 15:08:35 +01:00
|
|
|
name: 'Cool NFT',
|
|
|
|
tokenId: '555',
|
|
|
|
description: null,
|
|
|
|
}),
|
|
|
|
).toBe('Cool NFT 555');
|
|
|
|
expect(
|
2023-02-16 20:23:29 +01:00
|
|
|
getNftImageAlt({
|
2023-01-25 15:08:35 +01:00
|
|
|
name: 'Cool NFT',
|
|
|
|
tokenId: '555',
|
|
|
|
}),
|
|
|
|
).toBe('Cool NFT 555');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|