1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-05 15:35:46 +01:00
metamask-extension/ui/components/app/snaps/snap-version/snap-version.test.js

28 lines
955 B
JavaScript
Raw Normal View History

import * as React from 'react';
import { renderWithLocalization } from '../../../../../test/lib/render-helpers';
import SnapVersion from './snap-version';
describe('SnapVersion', () => {
const args = {
version: '1.4.2',
url: 'https://www.npmjs.com/package/@metamask/test-snap-error',
};
it('should render the SnapVersion without crashing and display a version', () => {
const { getByText, container } = renderWithLocalization(
<SnapVersion {...args} />,
);
expect(getByText(`v${args.version}`)).toBeDefined();
expect(container.firstChild).toHaveAttribute('href', args.url);
});
it('should have a loading state if no version is passed', () => {
args.version = undefined;
const { container } = renderWithLocalization(<SnapVersion {...args} />);
expect(container.getElementsByClassName('preloader__icon')).toHaveLength(1);
expect(container.firstChild).toHaveAttribute('href', args.url);
});
});