import React from 'react' import { render, screen } from '@testing-library/react' import * as axios from 'axios' import Publisher from './' const account = '0x0000000000000000000000000000000000000000' jest.mock('axios') describe('Publisher', () => { test('should return correct markup by default', async () => { ;(axios as any).get.mockImplementationOnce(() => Promise.resolve({ data: { name: 'jellymcjellyfish.eth' } }) ) render() const element = await screen.findByRole('link') expect(element).toBeInTheDocument() expect(element).toContainHTML(' { ;(axios as any).get.mockImplementationOnce(() => Promise.resolve({ data: { name: null } }) ) render() const element = await screen.findByText('0x…00000000') expect(element).toBeInTheDocument() }) test('should return correct markup in minimal state', async () => { ;(axios as any).get.mockImplementationOnce(() => Promise.resolve({ data: { name: null } }) ) render() const element = await screen.findByText('0x…00000000') expect(element).not.toHaveAttribute('href') }) test('should return markup with empty account', async () => { ;(axios as any).get.mockImplementationOnce(() => Promise.resolve({ data: { name: null } }) ) render() const element = await screen.findByRole('link') expect(element).toBeInTheDocument() }) })