Skip to content

Commit

Permalink
Fix tablist test perf to fix Nuget pipeline (#3831)
Browse files Browse the repository at this point in the history
* Make tablist test not async so that it runs faster

* Change files
  • Loading branch information
rurikoaraki authored Jan 9, 2025
1 parent 32a2af0 commit 4490805
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 33 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Make tablist test not async so that it runs faster",
"packageName": "@fluentui-react-native/tablist",
"email": "[email protected]",
"dependentChangeType": "patch"
}
21 changes: 6 additions & 15 deletions packages/components/TabList/src/TabList/__tests__/TabList.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@ describe('TabList component tests', () => {
)
.toJSON();
expect(tree).toMatchSnapshot();
// Each test needs this, again having to do with tests failing during the second render.
await renderer.act(async () => null);
});

it('TabList selected key', async () => {
it('TabList selected key', () => {
const tree = renderer
.create(
<TabList selectedKey="1">
Expand All @@ -36,10 +34,9 @@ describe('TabList component tests', () => {
)
.toJSON();
expect(tree).toMatchSnapshot();
await renderer.act(async () => null);
});

it('TabList disabled list', async () => {
it('TabList disabled list', () => {
const tree = renderer
.create(
<TabList disabled>
Expand All @@ -50,10 +47,9 @@ describe('TabList component tests', () => {
)
.toJSON();
expect(tree).toMatchSnapshot();
await renderer.act(async () => null);
});

it('TabList appearance', async () => {
it('TabList appearance', () => {
const tree = renderer
.create(
<TabList appearance="subtle">
Expand All @@ -64,10 +60,9 @@ describe('TabList component tests', () => {
)
.toJSON();
expect(tree).toMatchSnapshot();
await renderer.act(async () => null);
});

it('TabList size', async () => {
it('TabList size', () => {
const tree = renderer
.create(
<TabList size="large">
Expand All @@ -78,10 +73,9 @@ describe('TabList component tests', () => {
)
.toJSON();
expect(tree).toMatchSnapshot();
await renderer.act(async () => null);
});

it('TabList orientation', async () => {
it('TabList orientation', () => {
const tree = renderer
.create(
<TabList vertical>
Expand All @@ -92,20 +86,17 @@ describe('TabList component tests', () => {
)
.toJSON();
expect(tree).toMatchSnapshot();
await renderer.act(async () => null);
});

it('TabList re-renders correctly', async () => {
it('TabList re-renders correctly', () => {
checkReRender(
() => (
<TabList>
<Tab tabKey="1">Tab 1</Tab>
<Tab tabKey="2">Tab 2</Tab>
<Tab tabKey="3">Tab 3</Tab>
</TabList>
),
2,
);
await renderer.act(async () => null);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ exports[`TabList component tests TabList appearance 1`] = `
]
}
accessibilityLabel="Tab 1"
accessibilityPositionInSet={0}
accessibilityPositionInSet={1}
accessibilityRole="tab"
accessibilitySetSize={0}
accessibilitySetSize={3}
accessibilityState={
{
"busy": undefined,
Expand Down Expand Up @@ -182,9 +182,9 @@ exports[`TabList component tests TabList appearance 1`] = `
]
}
accessibilityLabel="Tab 2"
accessibilityPositionInSet={0}
accessibilityPositionInSet={2}
accessibilityRole="tab"
accessibilitySetSize={0}
accessibilitySetSize={3}
accessibilityState={
{
"busy": undefined,
Expand Down Expand Up @@ -317,9 +317,9 @@ exports[`TabList component tests TabList appearance 1`] = `
]
}
accessibilityLabel="Tab 3"
accessibilityPositionInSet={0}
accessibilityPositionInSet={3}
accessibilityRole="tab"
accessibilitySetSize={0}
accessibilitySetSize={3}
accessibilityState={
{
"busy": undefined,
Expand Down Expand Up @@ -1391,9 +1391,9 @@ exports[`TabList component tests TabList orientation 1`] = `
]
}
accessibilityLabel="Tab 1"
accessibilityPositionInSet={0}
accessibilityPositionInSet={1}
accessibilityRole="tab"
accessibilitySetSize={0}
accessibilitySetSize={3}
accessibilityState={
{
"busy": undefined,
Expand Down Expand Up @@ -1525,9 +1525,9 @@ exports[`TabList component tests TabList orientation 1`] = `
]
}
accessibilityLabel="Tab 2"
accessibilityPositionInSet={0}
accessibilityPositionInSet={2}
accessibilityRole="tab"
accessibilitySetSize={0}
accessibilitySetSize={3}
accessibilityState={
{
"busy": undefined,
Expand Down Expand Up @@ -1659,9 +1659,9 @@ exports[`TabList component tests TabList orientation 1`] = `
]
}
accessibilityLabel="Tab 3"
accessibilityPositionInSet={0}
accessibilityPositionInSet={3}
accessibilityRole="tab"
accessibilitySetSize={0}
accessibilitySetSize={3}
accessibilityState={
{
"busy": undefined,
Expand Down Expand Up @@ -1837,9 +1837,9 @@ exports[`TabList component tests TabList selected key 1`] = `
]
}
accessibilityLabel="Tab 1"
accessibilityPositionInSet={0}
accessibilityPositionInSet={1}
accessibilityRole="tab"
accessibilitySetSize={0}
accessibilitySetSize={3}
accessibilityState={
{
"busy": undefined,
Expand Down Expand Up @@ -1972,9 +1972,9 @@ exports[`TabList component tests TabList selected key 1`] = `
]
}
accessibilityLabel="Tab 2"
accessibilityPositionInSet={0}
accessibilityPositionInSet={2}
accessibilityRole="tab"
accessibilitySetSize={0}
accessibilitySetSize={3}
accessibilityState={
{
"busy": undefined,
Expand Down Expand Up @@ -2107,9 +2107,9 @@ exports[`TabList component tests TabList selected key 1`] = `
]
}
accessibilityLabel="Tab 3"
accessibilityPositionInSet={0}
accessibilityPositionInSet={3}
accessibilityRole="tab"
accessibilitySetSize={0}
accessibilitySetSize={3}
accessibilityState={
{
"busy": undefined,
Expand Down

0 comments on commit 4490805

Please sign in to comment.