Skip to content

Commit 1f696ba

Browse files
committed
Add real-word test cases with type imports
1 parent c0d00b2 commit 1f696ba

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

test/imports.test.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1896,6 +1896,44 @@ const typescriptTests = {
18961896
},
18971897
errors: 1,
18981898
},
1899+
1900+
// `groups` – real-world example from issue #61 based on:
1901+
// https://github.com/polkadot-js/apps/blob/074b245a725873f7c3c16fc83b80fb9c02351a65/packages/apps/src/Endpoints/Group.tsx
1902+
// https://github.com/polkadot-js/apps/blob/074b245a725873f7c3c16fc83b80fb9c02351a65/.eslintrc.js#L31-L39
1903+
{
1904+
options: [
1905+
{
1906+
groups: [
1907+
["^[^@.].*\\u0000$", "^[^/.]"],
1908+
["^@polkadot.*\\u0000$", "^@polkadot"],
1909+
["^\\..*\\u0000$", "^\\."],
1910+
],
1911+
},
1912+
],
1913+
code: input`
1914+
|import React, { useCallback } from 'react';
1915+
|import styled from 'styled-components';
1916+
|
1917+
|import { Icon } from '@polkadot/react-components';
1918+
|import type { ThemeProps } from '@polkadot/react-components/types';
1919+
|
1920+
|import Network from './Network';
1921+
|import type { Group } from './types';
1922+
`,
1923+
output: (actual) => {
1924+
expect(actual).toMatchInlineSnapshot(`
1925+
|import React, { useCallback } from 'react';
1926+
|import styled from 'styled-components';
1927+
|
1928+
|import type { ThemeProps } from '@polkadot/react-components/types';
1929+
|import { Icon } from '@polkadot/react-components';
1930+
|
1931+
|import type { Group } from './types';
1932+
|import Network from './Network';
1933+
`);
1934+
},
1935+
errors: 1,
1936+
},
18991937
],
19001938
};
19011939

0 commit comments

Comments
 (0)