Skip to content

Commit

Permalink
Migrate Heading tests to tsx (grommet#5723)
Browse files Browse the repository at this point in the history
* Add node types to tsconfig compilerOptions

* Migrate Heading test to tsx file

* Change node types from tsconfig to test file

Co-authored-by: Eric Soderberg <[email protected]>
  • Loading branch information
Lukazovic and ericsoderberghp authored Oct 25, 2021
1 parent ef2faf5 commit 8d257a4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@ test('Heading renders', () => {
});

test('Heading accepts ref', () => {
const ref = React.createRef();
const ref = React.createRef<HTMLHeadingElement>();
const { container } = render(
<Grommet>
<Heading ref={ref} />
</Grommet>,
{ createNodeMock: (el) => el },
);

expect(ref.current).not.toBeNull();
Expand Down Expand Up @@ -226,9 +225,7 @@ test('Theme color renders', () => {
});

test('Throws a warning when heading.level is undefined in the theme.', () => {
global.console = {
warn: jest.fn(),
};
global.console.warn = jest.fn();

const customTheme = {
heading: {
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
"noFallthroughCasesInSwitch": true,
"types": ["jest", "node"]
},
"exclude": ["node_modules"],
"include": ["**/__tests__"]
Expand Down

0 comments on commit 8d257a4

Please sign in to comment.