Skip to content

Commit

Permalink
remove checkRenderConsistency / checkReRender tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Saadnajmi committed Jan 29, 2025
1 parent 633da1c commit 3190b95
Show file tree
Hide file tree
Showing 17 changed files with 0 additions and 332 deletions.
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
import * as React from 'react';
import { ComponentName } from '../ComponentName';
import * as renderer from 'react-test-renderer';
import { checkRenderConsistency, checkReRender } from '@fluentui-react-native/test-tools';

describe('ComponentName component tests', () => {
it('ComponentName default', () => {
const tree = renderer.create(<ComponentName>Your component</ComponentName>).toJSON();
expect(tree).toMatchSnapshot();
});

it('ComponentName simple rendering does not invalidate styling', () => {
checkRenderConsistency(() => <ComponentName>Default ComponentName</ComponentName>, 2);
});

it('ComponentName re-renders correctly', () => {
checkReRender(() => <ComponentName>Render twice</ComponentName>, 2);
});

// Feel free to add more tests here
});
9 changes: 0 additions & 9 deletions packages/components/Badge/src/__tests__/Badge.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as React from 'react';

import { checkRenderConsistency, checkReRender } from '@fluentui-react-native/test-tools';
import * as renderer from 'react-test-renderer';

import { Badge, CounterBadge, PresenceBadge } from '../';
Expand Down Expand Up @@ -44,14 +43,6 @@ describe('Badge component tests', () => {
const tree = renderer.create(<BadgeWithShadow appearance="filled">Badge with shadow</BadgeWithShadow>).toJSON();
expect(tree).toMatchSnapshot();
});

it('Check checkRenderConsistency for Badge', () => {
checkRenderConsistency(() => <Badge />, 2);
});

it('Badge re-renders correctly', () => {
checkReRender(() => <Badge />, 2);
});
});

describe('PresenceBadge component tests', () => {
Expand Down
19 changes: 0 additions & 19 deletions packages/components/Button/src/Button.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import * as React from 'react';
import { Pressable, Text } from 'react-native';

import { Icon } from '@fluentui-react-native/icon';
import { checkRenderConsistency, checkReRender } from '@fluentui-react-native/test-tools';
import * as renderer from 'react-test-renderer';

import { Button } from './Button';
Expand Down Expand Up @@ -65,22 +64,4 @@ describe('Button component tests', () => {
const tree = renderer.create(<ComposedButton>Composed Button with RNText</ComposedButton>).toJSON();
expect(tree).toMatchSnapshot();
});

it('Button simple rendering does not invalidate styling', () => {
checkRenderConsistency(() => <Button>Default button</Button>, 2);
});

it('Button re-renders correctly', () => {
checkReRender(() => <Button>Render twice</Button>, 2);
});

it('Button shares produced styles across multiple renders', () => {
const style = { backgroundColor: 'black' };
checkRenderConsistency(() => <Button style={style}>Shared styles</Button>, 2);
});

it('Button re-renders correctly with style', () => {
const style = { borderColor: 'blue' };
checkReRender(() => <Button style={style}>Shared Style Render</Button>, 2);
});
});
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as React from 'react';

import { checkRenderConsistency, checkReRender } from '@fluentui-react-native/test-tools';
import * as renderer from 'react-test-renderer';

import { CompoundButton } from './CompoundButton';
Expand All @@ -9,21 +8,3 @@ it('CompoundButton default', () => {
const tree = renderer.create(<CompoundButton secondaryContent="sublabel">Default Button</CompoundButton>).toJSON();
expect(tree).toMatchSnapshot();
});

it('Button simple rendering does not invalidate styling', () => {
checkRenderConsistency(() => <CompoundButton>Default button</CompoundButton>, 2);
});

it('Button re-renders correctly', () => {
checkReRender(() => <CompoundButton>Render twice</CompoundButton>, 2);
});

it('Button shares produced styles across multiple renders', () => {
const style = { backgroundColor: 'black' };
checkRenderConsistency(() => <CompoundButton style={style}>Shared styles</CompoundButton>, 2);
});

it('Button re-renders correctly with style', () => {
const style = { borderColor: 'blue' };
checkReRender(() => <CompoundButton style={style}>Shared Style Render</CompoundButton>, 2);
});
33 changes: 0 additions & 33 deletions packages/components/Button/src/FAB/FAB.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as React from 'react';

import { checkRenderConsistency, checkReRender } from '@fluentui-react-native/test-tools';
import * as renderer from 'react-test-renderer';

import { FAB } from './FAB';
Expand Down Expand Up @@ -30,38 +29,6 @@ it('Custom FAB with no shadow(iOS)', () => {
expect(tree).toMatchSnapshot();
});

it('Button simple rendering does not invalidate styling', () => {
checkRenderConsistency(() => <FAB icon={iconProps}>Default FAB</FAB>, 2);
});

it('FAB re-renders correctly', () => {
checkReRender(() => <FAB icon={iconProps}>Render twice</FAB>, 2);
});

it('FAB shares produced styles across multiple renders', () => {
const style = { backgroundColor: 'black' };
checkRenderConsistency(
() => (
<FAB icon={iconProps} style={style}>
Shared styles
</FAB>
),
2,
);
});

it('FAB re-renders correctly with style', () => {
const style = { borderColor: 'blue' };
checkReRender(
() => (
<FAB icon={iconProps} style={style}>
Shared Style Render
</FAB>
),
2,
);
});

afterAll(() => {
jest.unmock('react-native/Libraries/Utilities/Platform');
});
19 changes: 0 additions & 19 deletions packages/components/Button/src/ToggleButton/ToggleButton.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as React from 'react';

import { checkRenderConsistency, checkReRender } from '@fluentui-react-native/test-tools';
import * as renderer from 'react-test-renderer';

import { ToggleButton } from './ToggleButton';
Expand All @@ -9,21 +8,3 @@ it('ToggleButton default', () => {
const tree = renderer.create(<ToggleButton>Default Button</ToggleButton>).toJSON();
expect(tree).toMatchSnapshot();
});

it('Button simple rendering does not invalidate styling', () => {
checkRenderConsistency(() => <ToggleButton>Default button</ToggleButton>, 2);
});

it('Button re-renders correctly', () => {
checkReRender(() => <ToggleButton>Render twice</ToggleButton>, 2);
});

it('Button shares produced styles across multiple renders', () => {
const style = { backgroundColor: 'black' };
checkRenderConsistency(() => <ToggleButton style={style}>Shared styles</ToggleButton>, 2);
});

it('Button re-renders correctly with style', () => {
const style = { borderColor: 'blue' };
checkReRender(() => <ToggleButton style={style}>Shared Style Render</ToggleButton>, 2);
});
25 changes: 0 additions & 25 deletions packages/components/Checkbox/src/__tests__/Checkbox.test.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import * as React from 'react';
import type { AccessibilityActionName } from 'react-native';
import { Text, View } from 'react-native';

import type { InteractionEvent } from '@fluentui-react-native/interactive-hooks';
import { checkRenderConsistency, checkReRender } from '@fluentui-react-native/test-tools';
import { Svg } from 'react-native-svg';
import * as renderer from 'react-test-renderer';

Expand Down Expand Up @@ -80,27 +78,4 @@ describe('Checkbox component tests', () => {
const tree = renderer.create(<ComposedCheckbox label="Composed Button with RNText" />).toJSON();
expect(tree).toMatchSnapshot();
});

it('Checkbox simple rendering does not invalidate styling', () => {
checkRenderConsistency(() => <Checkbox>Default button</Checkbox>, 2);
});

it('Checkbox re-renders correctly', () => {
checkReRender(() => <Checkbox>Render twice</Checkbox>, 2);
});

it('Checkbox shares produced styles across multiple renders', () => {
const style = { backgroundColor: 'black' };
checkRenderConsistency(() => <Checkbox style={style}>Shared styles</Checkbox>, 2);
});

it('Checkbox re-renders correctly with style', () => {
const style = { borderColor: 'blue' };
checkReRender(() => <Checkbox style={style}>Shared Style Render</Checkbox>, 2);
});

it('Checkbox re-renders correctly with accessibilityAction', () => {
const action = [{ name: 'Expand' as AccessibilityActionName }];
checkReRender(() => <Checkbox accessibilityActions={action}>Shared Style Render</Checkbox>, 2);
});
});
9 changes: 0 additions & 9 deletions packages/components/Chip/src/__tests__/Chip.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as React from 'react';

import { checkRenderConsistency, checkReRender } from '@fluentui-react-native/test-tools';
import * as renderer from 'react-test-renderer';

import { Chip } from '../';
Expand Down Expand Up @@ -30,12 +29,4 @@ describe('Chip component tests', () => {
const tree = renderer.create(<ChipStyled>Chip Tokens</ChipStyled>).toJSON();
expect(tree).toMatchSnapshot();
});

it('Check checkRenderConsistency for Chip', () => {
checkRenderConsistency(() => <Chip />, 2);
});

it('Chip re-renders correctly', () => {
checkReRender(() => <Chip />, 2);
});
});
9 changes: 0 additions & 9 deletions packages/components/Icon/src/__tests__/Icon.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as React from 'react';

import { checkRenderConsistency, checkReRender } from '@fluentui-react-native/test-tools';
import { Path, Svg } from 'react-native-svg';
import * as renderer from 'react-test-renderer';

Expand Down Expand Up @@ -45,12 +44,4 @@ describe('Icon component tests', () => {
const tree = renderer.create(<IconV1 svgSource={{ src: AccessTime20RegularIcon, width: 20, height: 20 }} />).toJSON();
expect(tree).toMatchSnapshot();
});

it('Icon checkRenderConsistency', () => {
checkRenderConsistency(() => <FontIcon {...fontProps} />, 2);
});

it('Icon re-renders correctly', () => {
checkReRender(() => <FontIcon {...fontProps} />, 2);
});
});
13 changes: 0 additions & 13 deletions packages/components/Input/src/__tests__/Input.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as React from 'react';

import { checkRenderConsistency, checkReRender } from '@fluentui-react-native/test-tools';
import * as renderer from 'react-test-renderer';

import { Input } from '../Input';
Expand Down Expand Up @@ -42,16 +41,4 @@ describe('Input component tests', () => {
const tree = renderer.create(<Input error="Error" />).toJSON();
expect(tree).toMatchSnapshot();
});

it('Input simple rendering does not invalidate styling', () => {
checkRenderConsistency(() => <Input />, 2);
});

it('Input re-renders correctly', () => {
checkReRender(() => <Input />, 2);
});

it('Input with placeholder', () => {
checkReRender(() => <Input placeholder="Test" accessoryIcon={null} />, 2);
});
});
33 changes: 0 additions & 33 deletions packages/components/Link/src/__tests__/Link.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as React from 'react';
import { Alert } from 'react-native';

import { checkRenderConsistency, checkReRender } from '@fluentui-react-native/test-tools';
import * as renderer from 'react-test-renderer';

import { Link } from '../Link';
Expand Down Expand Up @@ -41,36 +40,4 @@ describe('Link component tests', () => {
.toJSON();
expect(tree).toMatchSnapshot();
});

it('Link simple rendering does not invalidate styling', () => {
checkRenderConsistency(() => <Link url="https://www.bing.com">Link to Bing</Link>, 2);
});

it('Link re-renders correctly', () => {
checkReRender(() => <Link url="https://www.bing.com">Render twice</Link>, 2);
});

it('Link shares produced styles across multiple renders', () => {
const style = { color: 'black' };
checkRenderConsistency(
() => (
<Link style={style} url="https://www.bing.com">
Shared styles
</Link>
),
2,
);
});

it('Link re-renders correctly with style', () => {
const style = { color: 'black' };
checkReRender(
() => (
<Link style={style} url="https://www.bing.com">
Shared Style Render
</Link>
),
2,
);
});
});
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as React from 'react';

import { checkRenderConsistency, checkReRender } from '@fluentui-react-native/test-tools';
import * as renderer from 'react-test-renderer';

import { Notification } from '../Notification';
Expand Down Expand Up @@ -31,44 +30,4 @@ describe('Notification component tests', () => {
.toJSON();
expect(tree).toMatchSnapshot();
});

it('Notification simple rendering does not invalidate styling', () => {
checkRenderConsistency(
() => (
<Notification
variant={'primary'}
action="Undo"
onPress={() => {
console.log('Notification tapped');
}}
onActionPress={() => {
console.log('Undo tapped');
}}
>
Mail Archived
</Notification>
),
2,
);
});

it('Notification re-renders correctly', () => {
checkReRender(
() => (
<Notification
variant={'primary'}
action="Undo"
onPress={() => {
console.log('Notification tapped');
}}
onActionPress={() => {
console.log('Undo tapped');
}}
>
Mail Archived
</Notification>
),
2,
);
});
});
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as React from 'react';

import { checkRenderConsistency, checkReRender } from '@fluentui-react-native/test-tools';
import * as renderer from 'react-test-renderer';

import { Radio } from '../../Radio/Radio';
Expand Down Expand Up @@ -86,14 +85,4 @@ describe('RadioGroup component tests', () => {
expect(tree).toMatchSnapshot();
await renderer.act(async () => null);
});

it('RadioGroup simple rendering does not invalidate styling', async () => {
checkRenderConsistency(() => <RadioGroup>Default RadioGroup</RadioGroup>, 2);
await renderer.act(async () => null);
});

it('RadioGroup re-renders correctly', async () => {
checkReRender(() => <RadioGroup>Render twice</RadioGroup>, 2);
await renderer.act(async () => null);
});
});
Loading

0 comments on commit 3190b95

Please sign in to comment.