Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

Commit

Permalink
update tests for teraa-application-links
Browse files Browse the repository at this point in the history
  • Loading branch information
SP1556422 authored and SP1556422 committed Apr 10, 2024
1 parent 737eb4b commit 9ebce0b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,25 @@ import ThemeContextProvider from 'terra-theme-context/lib/ThemeContextProvider';
import ApplicationTabs from '../../src/tabs/ApplicationTabs';
import testLinkConfig from './testLinkConfig';
import testLinksWithIconsConfig from './testLinksWithIconsConfig';
import { BrowserRouter } from 'react-router-dom';

Check failure on line 7 in packages/terra-application-links/tests/jest/ApplicationTabs.test.jsx

View workflow job for this annotation

GitHub Actions / build

`react-router-dom` import should occur before import of `../../src/tabs/ApplicationTabs`

// Snapshot tests
it('should render ApplicationTabs with links and alignment', () => {
const wrapper = enzyme.shallow(<div><ApplicationTabs links={testLinkConfig} alignment="start" /></div>);
expect(wrapper).toMatchSnapshot();
});

it('should render ApplicationTabs with links and alignment and onTabClick handler', () => {
const wrapper = enzyme.shallow(<div><ApplicationTabs links={testLinkConfig} alignment="start" onTabClick={() => {}} /></div>);
expect(wrapper).toMatchSnapshot();
it('should trigger onTabClick handler', () => {
const onTabClickHandler = jest.fn();
const wrapper = enzymeIntl.mountWithIntl(
<BrowserRouter>
<ApplicationTabs links={testLinkConfig} alignment="start" onTabClick={onTabClickHandler} />
</BrowserRouter>

Check failure on line 20 in packages/terra-application-links/tests/jest/ApplicationTabs.test.jsx

View workflow job for this annotation

GitHub Actions / build

Missing trailing comma
);

wrapper.find('.tab').first().simulate('click');

expect(onTabClickHandler).toHaveBeenCalled();
});

it('should render ApplicationTabs with icons', () => {
Expand Down
12 changes: 6 additions & 6 deletions packages/terra-application-links/tests/jest/testLinkConfig.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
const testLinkConfig = [
{ path: '/test1', text: 'test 1' },
{ path: '/test2', text: 'test 2' },
{ path: '/test3', text: 'test 3' },
{ path: '/test4', text: 'test 4' },
{ path: '/test5', text: 'test 5' },
{ path: '/test6', text: 'test 6' },
{ id: 'link1', path: '/test1', text: 'test 1', icon: jest.fn() },

Check failure on line 2 in packages/terra-application-links/tests/jest/testLinkConfig.js

View workflow job for this annotation

GitHub Actions / build

Expected a line break after this opening brace

Check failure on line 2 in packages/terra-application-links/tests/jest/testLinkConfig.js

View workflow job for this annotation

GitHub Actions / build

Expected a line break before this closing brace
{ id: 'link2', path: '/test2', text: 'test 2', icon: jest.fn() },

Check failure on line 3 in packages/terra-application-links/tests/jest/testLinkConfig.js

View workflow job for this annotation

GitHub Actions / build

Expected a line break after this opening brace

Check failure on line 3 in packages/terra-application-links/tests/jest/testLinkConfig.js

View workflow job for this annotation

GitHub Actions / build

Expected a line break before this closing brace
{ id: 'link3', path: '/test3', text: 'test 3', icon: jest.fn() },

Check failure on line 4 in packages/terra-application-links/tests/jest/testLinkConfig.js

View workflow job for this annotation

GitHub Actions / build

Expected a line break after this opening brace

Check failure on line 4 in packages/terra-application-links/tests/jest/testLinkConfig.js

View workflow job for this annotation

GitHub Actions / build

Expected a line break before this closing brace
{ id: 'link4', path: '/test4', text: 'test 4', icon: jest.fn() },

Check failure on line 5 in packages/terra-application-links/tests/jest/testLinkConfig.js

View workflow job for this annotation

GitHub Actions / build

Expected a line break after this opening brace

Check failure on line 5 in packages/terra-application-links/tests/jest/testLinkConfig.js

View workflow job for this annotation

GitHub Actions / build

Expected a line break before this closing brace
{ id: 'link5', path: '/test5', text: 'test 5', icon: jest.fn() },
{ id: 'link6', path: '/test6', text: 'test 6', icon: jest.fn() },
];

export default testLinkConfig;

0 comments on commit 9ebce0b

Please sign in to comment.