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

Commit

Permalink
Add mock for uuid
Browse files Browse the repository at this point in the history
  • Loading branch information
ry061521 committed Sep 8, 2023
1 parent ab9b4f5 commit 61eb672
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 89 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import React from 'react';
import { shallowWithIntl } from 'terra-enzyme-intl';
import ItemView from '../../lib/ItemView';

jest.mock('uuid', () => ({ v4: () => '00000000-0000-0000-0000-000000000000' }));

// Note: when multiple displays are passed in to the ItemView, the length of 'ItemDisplay' in these tests will
// be 1 greater than the amount of displays passed in. This is because when ItemView contains multiple
// displays a header is created to label the displays within their unordered list. This header contains a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ exports[`should render 2 start theme displays 1`] = `
<div>
<h6
hidden={true}
id="single-column-header-3ccbd10e-a07a-4ac3-b25e-734a64830241"
id="single-column-header-00000000-0000-0000-0000-000000000000"
>
<ItemDisplay
iconAlignment="center"
Expand Down Expand Up @@ -112,7 +112,7 @@ exports[`should render 2 start theme displays 1`] = `
/>
</h6>
<ul
aria-labelledby="single-column-header-3ccbd10e-a07a-4ac3-b25e-734a64830241"
aria-labelledby="single-column-header-00000000-0000-0000-0000-000000000000"
className="column-list-container"
>
<li
Expand Down Expand Up @@ -211,7 +211,7 @@ exports[`should render 3 start theme displays 1`] = `
<div>
<h6
hidden={true}
id="single-column-header-53819a7b-b514-43e1-bcf9-94246ff0e225"
id="single-column-header-00000000-0000-0000-0000-000000000000"
>
<ItemDisplay
iconAlignment="center"
Expand Down Expand Up @@ -249,7 +249,7 @@ exports[`should render 3 start theme displays 1`] = `
/>
</h6>
<ul
aria-labelledby="single-column-header-53819a7b-b514-43e1-bcf9-94246ff0e225"
aria-labelledby="single-column-header-00000000-0000-0000-0000-000000000000"
className="column-list-container"
>
<li
Expand Down Expand Up @@ -561,7 +561,7 @@ exports[`should render displays with original styling when overrideDefaultStylin
<div>
<h6
hidden={true}
id="single-column-header-cdfc026b-8349-43d3-9bd1-299f8e8f428d"
id="single-column-header-00000000-0000-0000-0000-000000000000"
>
<ItemDisplay
iconAlignment="center"
Expand Down Expand Up @@ -599,7 +599,7 @@ exports[`should render displays with original styling when overrideDefaultStylin
/>
</h6>
<ul
aria-labelledby="single-column-header-cdfc026b-8349-43d3-9bd1-299f8e8f428d"
aria-labelledby="single-column-header-00000000-0000-0000-0000-000000000000"
className="column-list-container"
>
<li
Expand Down Expand Up @@ -775,7 +775,7 @@ exports[`should render each column as an unordered list within a primary unorder
<div>
<h6
hidden={true}
id="two-column-header-2625f375-34e7-4976-84d5-f20c14244faf"
id="two-column-header-00000000-0000-0000-0000-000000000000"
>
<ItemDisplay
iconAlignment="center"
Expand Down Expand Up @@ -813,7 +813,7 @@ exports[`should render each column as an unordered list within a primary unorder
/>
</h6>
<ul
aria-labelledby="two-column-header-2625f375-34e7-4976-84d5-f20c14244faf"
aria-labelledby="two-column-header-00000000-0000-0000-0000-000000000000"
className="column-list-container"
>
<li
Expand Down Expand Up @@ -970,7 +970,7 @@ exports[`should render one column 1`] = `
<div>
<h6
hidden={true}
id="single-column-header-e87ee649-a0b0-4bc5-bba6-04814edfbb66"
id="single-column-header-00000000-0000-0000-0000-000000000000"
>
<ItemDisplay
iconAlignment="center"
Expand Down Expand Up @@ -1008,7 +1008,7 @@ exports[`should render one column 1`] = `
/>
</h6>
<ul
aria-labelledby="single-column-header-e87ee649-a0b0-4bc5-bba6-04814edfbb66"
aria-labelledby="single-column-header-00000000-0000-0000-0000-000000000000"
className="column-list-container"
>
<li
Expand Down Expand Up @@ -1107,7 +1107,7 @@ exports[`should render several displays in an unordered list with a header for o
<div>
<h6
hidden={true}
id="single-column-header-389e52a9-5363-4067-984d-c7a6eb06d1b5"
id="single-column-header-00000000-0000-0000-0000-000000000000"
>
<ItemDisplay
iconAlignment="center"
Expand Down Expand Up @@ -1145,7 +1145,7 @@ exports[`should render several displays in an unordered list with a header for o
/>
</h6>
<ul
aria-labelledby="single-column-header-389e52a9-5363-4067-984d-c7a6eb06d1b5"
aria-labelledby="single-column-header-00000000-0000-0000-0000-000000000000"
className="column-list-container"
>
<li
Expand Down Expand Up @@ -1293,51 +1293,45 @@ exports[`should render truncated display 1`] = `
className="body"
>
<div
className="column-container"
className="single-result-column-container"
>
<div
className="primary-column"
key="0"
className="content content-primary-size content-primary-color"
>
<div
className="content content-primary-size content-primary-color"
key="0"
>
<ItemDisplay
iconAlignment="center"
intl={
Object {
"defaultFormats": Object {},
"defaultLocale": "en",
"formatDate": [Function],
"formatHTMLMessage": [Function],
"formatMessage": [Function],
"formatNumber": [Function],
"formatPlural": [Function],
"formatRelative": [Function],
"formatTime": [Function],
"formats": Object {},
"formatters": Object {
"getDateTimeFormat": [Function],
"getMessageFormat": [Function],
"getNumberFormat": [Function],
"getPluralFormat": [Function],
"getRelativeFormat": [Function],
},
"locale": "en",
"messages": null,
"now": [Function],
"onError": [Function],
"textComponent": "span",
"timeZone": null,
}
<ItemDisplay
iconAlignment="center"
intl={
Object {
"defaultFormats": Object {},
"defaultLocale": "en",
"formatDate": [Function],
"formatHTMLMessage": [Function],
"formatMessage": [Function],
"formatNumber": [Function],
"formatPlural": [Function],
"formatRelative": [Function],
"formatTime": [Function],
"formats": Object {},
"formatters": Object {
"getDateTimeFormat": [Function],
"getMessageFormat": [Function],
"getNumberFormat": [Function],
"getPluralFormat": [Function],
"getRelativeFormat": [Function],
},
"locale": "en",
"messages": null,
"now": [Function],
"onError": [Function],
"textComponent": "span",
"timeZone": null,
}
isDisabled={false}
isTruncated={false}
text="display1display1display1display1display1display1display1display1"
textStyle="primary"
/>
</div>
}
isDisabled={false}
isTruncated={false}
text="display1display1display1display1display1display1display1display1"
textStyle="primary"
/>
</div>
</div>
</div>
Expand Down Expand Up @@ -1404,36 +1398,58 @@ exports[`should render truncated two column displays when isTruncated is only se
<div
className="body"
>
<div
className="column-container"
>
<div
className="primary-column"
key="0"
<div>
<h6
hidden={true}
id="two-column-header-00000000-0000-0000-0000-000000000000"
>
<div
className="content content-primary-size content-primary-color"
key="0"
>
<InjectIntl(ItemDisplay)
isTruncated={true}
text="display1display1display1display1display1display1display1display1"
/>
</div>
</div>
<div
className="secondary-column"
key="1"
<InjectIntl(ItemDisplay)
isTruncated={true}
text="display1display1display1display1display1display1display1display1"
/>
</h6>
<ul
aria-labelledby="two-column-header-00000000-0000-0000-0000-000000000000"
className="column-list-container"
>
<div
className="content content-primary-size content-primary-color"
<li
className="primary-column"
key="0"
>
<InjectIntl(ItemDisplay)
text="display2display2display2display2display2display2display2display2"
/>
</div>
</div>
<ul
className="column-list"
key="0"
>
<li
className="content content-primary-size content-primary-color"
key="0"
>
<InjectIntl(ItemDisplay)
isTruncated={true}
text="display1display1display1display1display1display1display1display1"
/>
</li>
</ul>
</li>
<li
className="secondary-column"
key="1"
>
<ul
className="column-list"
key="1"
>
<li
className="content content-primary-size content-primary-color"
key="0"
>
<InjectIntl(ItemDisplay)
text="display2display2display2display2display2display2display2display2"
/>
</li>
</ul>
</li>
</ul>
</div>
</div>
</div>
Expand All @@ -1449,7 +1465,7 @@ exports[`should render two columns with 8 displays 1`] = `
<div>
<h6
hidden={true}
id="two-column-header-ac7fe7d9-b649-4876-bf4c-7fef33d4217c"
id="two-column-header-00000000-0000-0000-0000-000000000000"
>
<ItemDisplay
iconAlignment="center"
Expand Down Expand Up @@ -1487,7 +1503,7 @@ exports[`should render two columns with 8 displays 1`] = `
/>
</h6>
<ul
aria-labelledby="two-column-header-ac7fe7d9-b649-4876-bf4c-7fef33d4217c"
aria-labelledby="two-column-header-00000000-0000-0000-0000-000000000000"
className="column-list-container"
>
<li
Expand Down Expand Up @@ -1838,7 +1854,7 @@ exports[`should render two columns with 8 displays when trueColumn is false 1`]
<div>
<h6
hidden={true}
id="by-row-header-956ff6f1-f017-42ac-aee4-6c5e56130b23"
id="by-row-header-00000000-0000-0000-0000-000000000000"
>
<ItemDisplay
iconAlignment="center"
Expand Down Expand Up @@ -1876,7 +1892,7 @@ exports[`should render two columns with 8 displays when trueColumn is false 1`]
/>
</h6>
<ul
aria-labelledby="by-row-header-956ff6f1-f017-42ac-aee4-6c5e56130b23"
aria-labelledby="by-row-header-00000000-0000-0000-0000-000000000000"
className="row-list-container"
>
<li
Expand Down Expand Up @@ -2247,7 +2263,7 @@ exports[`should render two columns with an odd number of displays 1`] = `
<div>
<h6
hidden={true}
id="two-column-header-38e20d6f-4613-4282-bb8b-9bad731f2803"
id="two-column-header-00000000-0000-0000-0000-000000000000"
>
<ItemDisplay
iconAlignment="center"
Expand Down Expand Up @@ -2285,7 +2301,7 @@ exports[`should render two columns with an odd number of displays 1`] = `
/>
</h6>
<ul
aria-labelledby="two-column-header-38e20d6f-4613-4282-bb8b-9bad731f2803"
aria-labelledby="two-column-header-00000000-0000-0000-0000-000000000000"
className="column-list-container"
>
<li
Expand Down Expand Up @@ -2495,7 +2511,7 @@ exports[`should render with 2 displays 1`] = `
<div>
<h6
hidden={true}
id="single-column-header-67ed2dcf-d9cc-45aa-a34b-686019bcba60"
id="single-column-header-00000000-0000-0000-0000-000000000000"
>
<ItemDisplay
iconAlignment="center"
Expand Down Expand Up @@ -2533,7 +2549,7 @@ exports[`should render with 2 displays 1`] = `
/>
</h6>
<ul
aria-labelledby="single-column-header-67ed2dcf-d9cc-45aa-a34b-686019bcba60"
aria-labelledby="single-column-header-00000000-0000-0000-0000-000000000000"
className="column-list-container"
>
<li
Expand Down Expand Up @@ -2632,7 +2648,7 @@ exports[`should render with 3 displays 1`] = `
<div>
<h6
hidden={true}
id="single-column-header-d2016b66-f87b-433d-a695-d3323f1930dc"
id="single-column-header-00000000-0000-0000-0000-000000000000"
>
<ItemDisplay
iconAlignment="center"
Expand Down Expand Up @@ -2670,7 +2686,7 @@ exports[`should render with 3 displays 1`] = `
/>
</h6>
<ul
aria-labelledby="single-column-header-d2016b66-f87b-433d-a695-d3323f1930dc"
aria-labelledby="single-column-header-00000000-0000-0000-0000-000000000000"
className="column-list-container"
>
<li
Expand Down

0 comments on commit 61eb672

Please sign in to comment.