test(governance,markets): tidy up minor test quibbles (#4213)
This commit is contained in:
parent
45b7c2ad4d
commit
2fa00dacaa
@ -1,5 +0,0 @@
|
|||||||
function ReactMarkdown({ children }) {
|
|
||||||
return <div>{children}</div>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default ReactMarkdown;
|
|
@ -26,9 +26,12 @@ describe('Announcements', () => {
|
|||||||
const { container } = render(
|
const { container } = render(
|
||||||
<AnnouncementBanner app="console" configUrl={MOCK_URL} />
|
<AnnouncementBanner app="console" configUrl={MOCK_URL} />
|
||||||
);
|
);
|
||||||
await waitFor(() => {
|
await act(
|
||||||
expect(container.firstChild).toBeEmptyDOMElement();
|
async () =>
|
||||||
});
|
await waitFor(() => {
|
||||||
|
expect(container.firstChild).toBeEmptyDOMElement();
|
||||||
|
})
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('does not display the banner when there are no announcements', async () => {
|
it('does not display the banner when there are no announcements', async () => {
|
||||||
@ -42,9 +45,12 @@ describe('Announcements', () => {
|
|||||||
const { container } = render(
|
const { container } = render(
|
||||||
<AnnouncementBanner app="console" configUrl={MOCK_URL} />
|
<AnnouncementBanner app="console" configUrl={MOCK_URL} />
|
||||||
);
|
);
|
||||||
await waitFor(() => {
|
await act(
|
||||||
expect(container.firstChild).toBeEmptyDOMElement();
|
async () =>
|
||||||
});
|
await waitFor(() => {
|
||||||
|
expect(container.firstChild).toBeEmptyDOMElement();
|
||||||
|
})
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('shows the correct announcement', async () => {
|
it('shows the correct announcement', async () => {
|
||||||
@ -200,8 +206,11 @@ describe('Announcements', () => {
|
|||||||
jest.runOnlyPendingTimers();
|
jest.runOnlyPendingTimers();
|
||||||
});
|
});
|
||||||
|
|
||||||
await waitFor(() => {
|
await act(
|
||||||
expect(queryByText('Live text')).not.toBeInTheDocument();
|
async () =>
|
||||||
});
|
await waitFor(() => {
|
||||||
|
expect(queryByText('Live text')).not.toBeInTheDocument();
|
||||||
|
})
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -4,7 +4,8 @@ import { Networks } from '../types';
|
|||||||
import { useEnvironment } from './use-environment';
|
import { useEnvironment } from './use-environment';
|
||||||
import { stripFullStops } from '@vegaprotocol/utils';
|
import { stripFullStops } from '@vegaprotocol/utils';
|
||||||
|
|
||||||
const VEGA_DOCS_URL = process.env['NX_VEGA_DOCS_URL'] || '';
|
const VEGA_DOCS_URL =
|
||||||
|
process.env['NX_VEGA_DOCS_URL'] || 'https://docs.vega.xyz/mainnet';
|
||||||
|
|
||||||
type Net = Exclude<Networks, 'CUSTOM'>;
|
type Net = Exclude<Networks, 'CUSTOM'>;
|
||||||
export enum DApp {
|
export enum DApp {
|
||||||
|
@ -6,6 +6,7 @@ import {
|
|||||||
GITHUB_VEGA_DEV_RELEASES_DATA,
|
GITHUB_VEGA_DEV_RELEASES_DATA,
|
||||||
} from './mocks/github-releases';
|
} from './mocks/github-releases';
|
||||||
import { useVegaRelease } from './use-vega-release';
|
import { useVegaRelease } from './use-vega-release';
|
||||||
|
import { act } from 'react-dom/test-utils';
|
||||||
|
|
||||||
describe('useVegaRelease', () => {
|
describe('useVegaRelease', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
@ -31,8 +32,11 @@ describe('useVegaRelease', () => {
|
|||||||
|
|
||||||
it('should return undefined when a release cannot be found', async () => {
|
it('should return undefined when a release cannot be found', async () => {
|
||||||
const { result } = renderHook(() => useVegaRelease('v0.70.1'));
|
const { result } = renderHook(() => useVegaRelease('v0.70.1'));
|
||||||
await waitFor(() => {
|
await act(
|
||||||
expect(result.current).toEqual(undefined);
|
async () =>
|
||||||
});
|
await waitFor(() => {
|
||||||
|
expect(result.current).toEqual(undefined);
|
||||||
|
})
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -19,7 +19,6 @@ describe('useOracleMarkets', () => {
|
|||||||
it('returns correct market list for the given provider', () => {
|
it('returns correct market list for the given provider', () => {
|
||||||
mockMarkets.mockReturnValueOnce({ data: marketsData });
|
mockMarkets.mockReturnValueOnce({ data: marketsData });
|
||||||
const { result } = renderHook(() => useOracleMarkets(mockProvider));
|
const { result } = renderHook(() => useOracleMarkets(mockProvider));
|
||||||
console.log(JSON.stringify(result.current));
|
|
||||||
expect(result.current).toStrictEqual(oracleMarkets);
|
expect(result.current).toStrictEqual(oracleMarkets);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user