Fix snapshot tests

Previously all snapshots captured was a string representation of a
function (`[Function]`). This made the tests useless because the result
would always be a Function no matter what and so they will always pass,
even if material changes happened.
This commit is contained in:
Dorian Karter 2022-04-10 00:13:00 -05:00
parent 765ab6d643
commit 8eedb57104
26 changed files with 4645 additions and 120 deletions

View file

@ -1,3 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`app.tsx Tests GlobalStyle 1`] = `[Function]`;
exports[`app.tsx Tests GlobalStyle 1`] = `
<body>
<div />
</body>
`;

View file

@ -12,7 +12,7 @@ const props: IThemeProps = {
describe("app.tsx", () => {
it("Tests GlobalStyle", () => {
const { asFragment } = render(<GlobalStyle theme={props} />);
expect(asFragment).toMatchSnapshot();
const { baseElement } = render(<GlobalStyle theme={props} />);
expect(baseElement).toMatchSnapshot();
});
});

View file

@ -1,7 +1,108 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`app.tsx Tests app rendering with newTab=false 1`] = `[Function]`;
exports[`app.tsx Tests app rendering with newTab=false 1`] = `
<body>
<div>
<a
class="sc-dkzDqf gHJogt"
href="#"
>
<div
class="sc-hKMtZM kjGwCV"
>
<i
class="sc-gsnTZi ctUcHQ"
>
bug_report
</i>
</div>
<div
class="sc-eCYdqJ bcsQqv"
>
<div
class="sc-jSMfEi bkhPVp"
>
App Test
</div>
<p
class="sc-gKXOVf EDUWD"
>
test
</p>
</div>
</a>
</div>
</body>
`;
exports[`app.tsx Tests app rendering with newTab=true 1`] = `[Function]`;
exports[`app.tsx Tests app rendering with newTab=true 1`] = `
<body>
<div>
<a
class="sc-dkzDqf gHJogt"
href="#"
rel="noopener noreferrer"
target="_blank"
>
<div
class="sc-hKMtZM kjGwCV"
>
<i
class="sc-gsnTZi ctUcHQ"
>
bug_report
</i>
</div>
<div
class="sc-eCYdqJ bcsQqv"
>
<div
class="sc-jSMfEi bkhPVp"
>
App Test
</div>
<p
class="sc-gKXOVf EDUWD"
>
test
</p>
</div>
</a>
</div>
</body>
`;
exports[`app.tsx Tests app rendering without newTab 1`] = `[Function]`;
exports[`app.tsx Tests app rendering without newTab 1`] = `
<body>
<div>
<a
class="sc-dkzDqf gHJogt"
href="#"
>
<div
class="sc-hKMtZM kjGwCV"
>
<i
class="sc-gsnTZi ctUcHQ"
>
bug_report
</i>
</div>
<div
class="sc-eCYdqJ bcsQqv"
>
<div
class="sc-jSMfEi bkhPVp"
>
App Test
</div>
<p
class="sc-gKXOVf EDUWD"
>
test
</p>
</div>
</a>
</div>
</body>
`;

View file

@ -1,3 +1,85 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`AppCategory snapshot test 1`] = `[Function]`;
exports[`AppCategory snapshot test 1`] = `
<body>
<div>
<div
class="sc-evZas csYxrp"
>
<h3
class="sc-papXJ sc-crXcEl lhcacf ieLYyf"
>
Category Test
</h3>
<ul
class="sc-jqUVSM egPCCj"
>
<li
class="sc-kDDrLX OpKuo"
>
<a
class="sc-dkzDqf gHJogt"
href="#"
>
<div
class="sc-hKMtZM kjGwCV"
>
<i
class="sc-gsnTZi ctUcHQ"
>
bug_report
</i>
</div>
<div
class="sc-eCYdqJ bcsQqv"
>
<div
class="sc-jSMfEi bkhPVp"
>
App Test
</div>
<p
class="sc-gKXOVf EDUWD"
>
test
</p>
</div>
</a>
</li>
<li
class="sc-kDDrLX OpKuo"
>
<a
class="sc-dkzDqf gHJogt"
href="#"
>
<div
class="sc-hKMtZM kjGwCV"
>
<i
class="sc-gsnTZi ctUcHQ"
>
bug_report
</i>
</div>
<div
class="sc-eCYdqJ bcsQqv"
>
<div
class="sc-jSMfEi bkhPVp"
>
App Test
</div>
<p
class="sc-gKXOVf EDUWD"
>
test
</p>
</div>
</a>
</li>
</ul>
</div>
</div>
</body>
`;

View file

@ -1,9 +1,295 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`appList.tsx Tests AppList rendering with apps 1`] = `[Function]`;
exports[`appList.tsx Tests AppList rendering with apps 1`] = `
<body>
<div>
<div
class="sc-iBkjds ixywls"
>
<h2
class="sc-ftvSup bdxGxw"
>
Applications
</h2>
<div
class="sc-evZas csYxrp"
>
<ul
class="sc-jqUVSM egPCCj"
>
<li
class="sc-kDDrLX OpKuo"
>
<a
class="sc-dkzDqf gHJogt"
href="#"
>
<div
class="sc-hKMtZM kjGwCV"
>
<i
class="sc-gsnTZi ctUcHQ"
>
bug_report
</i>
</div>
<div
class="sc-eCYdqJ bcsQqv"
>
<div
class="sc-jSMfEi bkhPVp"
>
App Test
</div>
<p
class="sc-gKXOVf EDUWD"
>
test
</p>
</div>
</a>
</li>
</ul>
</div>
</div>
</div>
</body>
`;
exports[`appList.tsx Tests AppList rendering with categories 1`] = `[Function]`;
exports[`appList.tsx Tests AppList rendering with categories 1`] = `
<body>
<div>
<div
class="sc-iBkjds ixywls"
>
<h2
class="sc-ftvSup bdxGxw"
>
Applications
</h2>
<div
class="sc-evZas csYxrp"
>
<h3
class="sc-papXJ sc-crXcEl lhcacf ieLYyf"
>
Category Test
</h3>
<ul
class="sc-jqUVSM egPCCj"
>
<li
class="sc-kDDrLX OpKuo"
>
<a
class="sc-dkzDqf gHJogt"
href="#"
>
<div
class="sc-hKMtZM kjGwCV"
>
<i
class="sc-gsnTZi ctUcHQ"
>
bug_report
</i>
</div>
<div
class="sc-eCYdqJ bcsQqv"
>
<div
class="sc-jSMfEi bkhPVp"
>
App Test
</div>
<p
class="sc-gKXOVf EDUWD"
>
test
</p>
</div>
</a>
</li>
<li
class="sc-kDDrLX OpKuo"
>
<a
class="sc-dkzDqf gHJogt"
href="#"
>
<div
class="sc-hKMtZM kjGwCV"
>
<i
class="sc-gsnTZi ctUcHQ"
>
bug_report
</i>
</div>
<div
class="sc-eCYdqJ bcsQqv"
>
<div
class="sc-jSMfEi bkhPVp"
>
App Test
</div>
<p
class="sc-gKXOVf EDUWD"
>
test
</p>
</div>
</a>
</li>
</ul>
</div>
</div>
</div>
</body>
`;
exports[`appList.tsx Tests AppList rendering with categories and apps 1`] = `[Function]`;
exports[`appList.tsx Tests AppList rendering with categories and apps 1`] = `
<body>
<div>
<div
class="sc-iBkjds ixywls"
>
<h2
class="sc-ftvSup bdxGxw"
>
Applications
</h2>
<div
class="sc-evZas csYxrp"
>
<h3
class="sc-papXJ sc-crXcEl lhcacf ieLYyf"
>
Category Test
</h3>
<ul
class="sc-jqUVSM egPCCj"
>
<li
class="sc-kDDrLX OpKuo"
>
<a
class="sc-dkzDqf gHJogt"
href="#"
>
<div
class="sc-hKMtZM kjGwCV"
>
<i
class="sc-gsnTZi ctUcHQ"
>
bug_report
</i>
</div>
<div
class="sc-eCYdqJ bcsQqv"
>
<div
class="sc-jSMfEi bkhPVp"
>
App Test
</div>
<p
class="sc-gKXOVf EDUWD"
>
test
</p>
</div>
</a>
</li>
<li
class="sc-kDDrLX OpKuo"
>
<a
class="sc-dkzDqf gHJogt"
href="#"
>
<div
class="sc-hKMtZM kjGwCV"
>
<i
class="sc-gsnTZi ctUcHQ"
>
bug_report
</i>
</div>
<div
class="sc-eCYdqJ bcsQqv"
>
<div
class="sc-jSMfEi bkhPVp"
>
App Test
</div>
<p
class="sc-gKXOVf EDUWD"
>
test
</p>
</div>
</a>
</li>
</ul>
</div>
<div
class="sc-evZas csYxrp"
>
<h3
class="sc-papXJ sc-crXcEl lhcacf ieLYyf"
>
Uncategorized apps
</h3>
<ul
class="sc-jqUVSM egPCCj"
>
<li
class="sc-kDDrLX OpKuo"
>
<a
class="sc-dkzDqf gHJogt"
href="#"
>
<div
class="sc-hKMtZM kjGwCV"
>
<i
class="sc-gsnTZi ctUcHQ"
>
bug_report
</i>
</div>
<div
class="sc-eCYdqJ bcsQqv"
>
<div
class="sc-jSMfEi bkhPVp"
>
App Test
</div>
<p
class="sc-gKXOVf EDUWD"
>
test
</p>
</div>
</a>
</li>
</ul>
</div>
</div>
</div>
</body>
`;
exports[`appList.tsx Tests AppList rendering with neither 1`] = `[Function]`;
exports[`appList.tsx Tests AppList rendering with neither 1`] = `
<body>
<div />
</body>
`;

File diff suppressed because it is too large Load diff

View file

@ -1,11 +1,126 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`tests rendering of Bookmark with newTab=false 1`] = `[Function]`;
exports[`tests rendering of Bookmark with newTab=false 1`] = `
<body>
<div>
<a
class="sc-iBkjds ANOjH"
href="#"
>
Bookmark Test
</a>
</div>
</body>
`;
exports[`tests rendering of Bookmark with newTab=true 1`] = `[Function]`;
exports[`tests rendering of Bookmark with newTab=true 1`] = `
<body>
<div>
<a
class="sc-iBkjds ANOjH"
href="#"
rel="noopener noreferrer"
target="_blank"
>
Bookmark Test
</a>
</div>
</body>
`;
exports[`tests rendering of Bookmark without newTab 1`] = `[Function]`;
exports[`tests rendering of Bookmark without newTab 1`] = `
<body>
<div>
<a
class="sc-iBkjds ANOjH"
href="#"
>
Bookmark Test
</a>
</div>
</body>
`;
exports[`tests rendering of BookmarkGroup 1`] = `[Function]`;
exports[`tests rendering of BookmarkGroup 1`] = `
<body>
<div>
<li
class="sc-eCYdqJ jcnfPp"
>
<div
class="sc-gKXOVf kDgtUh"
>
<h3
class="sc-dkzDqf dzkwjK"
>
Test Group
</h3>
<a
class="sc-iBkjds ANOjH"
href="#"
>
Bookmark Test
</a>
</div>
</li>
</div>
</body>
`;
exports[`tests rendering of BookmarkList 1`] = `[Function]`;
exports[`tests rendering of BookmarkList 1`] = `
<body>
<div>
<div
class="sc-bczRLJ kimCm"
>
<h2
class="sc-gsnTZi jiVNCT"
>
Bookmarks
</h2>
<ul
class="sc-hKMtZM jEBHIA"
>
<li
class="sc-eCYdqJ jcnfPp"
>
<div
class="sc-gKXOVf kDgtUh"
>
<h3
class="sc-dkzDqf dzkwjK"
>
Test Group
</h3>
<a
class="sc-iBkjds ANOjH"
href="#"
>
Bookmark Test
</a>
</div>
</li>
<li
class="sc-eCYdqJ jcnfPp"
>
<div
class="sc-gKXOVf kDgtUh"
>
<h3
class="sc-dkzDqf dzkwjK"
>
Test Group
</h3>
<a
class="sc-iBkjds ANOjH"
href="#"
>
Bookmark Test
</a>
</div>
</li>
</ul>
</div>
</div>
</body>
`;

View file

@ -1,5 +1,28 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Greeter snapshot test with properties 1`] = `[Function]`;
exports[`Greeter snapshot test with properties 1`] = `
<body>
<div>
<div
class="sc-bczRLJ kimCm"
>
<h3
class="sc-dkzDqf jtvEMe"
>
Sunday, April 10th 2022
</h3>
<h1
class="sc-gsnTZi cdSBOi"
>
Good night!
</h1>
</div>
</div>
</body>
`;
exports[`Greeter snapshot test without properties 1`] = `[Function]`;
exports[`Greeter snapshot test without properties 1`] = `
<body>
<div />
</body>
`;

View file

@ -1,7 +1,42 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Icon test (no size) 1`] = `[Function]`;
exports[`Icon test (no size) 1`] = `
<body>
<div>
<i
class="sc-gsnTZi ctUcHQ"
>
bug_report
</i>
</div>
</body>
`;
exports[`Icon test 1`] = `[Function]`;
exports[`Icon test 1`] = `
<body>
<div>
<i
about="20px"
class="sc-gsnTZi iGhKXa"
>
bug_report
</i>
</div>
</body>
`;
exports[`IconButton test 1`] = `[Function]`;
exports[`IconButton test 1`] = `
<body>
<div>
<button
class="sc-bczRLJ liKoho"
>
<i
class="sc-gsnTZi ctUcHQ"
>
bug_report
</i>
</button>
</div>
</body>
`;

View file

@ -1,5 +1,122 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`imprint.tsx Tests Imprint 1`] = `[Function]`;
exports[`imprint.tsx Tests Imprint 1`] = `
<body>
<div>
<div
class="sc-bczRLJ kimCm"
>
<h2
class="sc-gsnTZi jiVNCT"
>
About
</h2>
<ul
class="sc-hKMtZM jEBHIA"
>
<div
class="sc-evZas dWbjhp"
>
<h3
class="sc-dkzDqf dzkwjK"
>
Imprint
</h3>
<div
class="sc-ftvSup cpmMIl"
hidden=""
>
<div
class="sc-jqUVSM izDwOx"
>
<h2
class="sc-gsnTZi jiVNCT"
>
Legal Disclosure
</h2>
<button
class="sc-gKXOVf inaviU"
data-testid="close-button"
>
<i
class="sc-iBkjds fflOgg"
>
close
</i>
</button>
</div>
<div>
<h3
class="sc-dkzDqf sc-kDDrLX dzkwjK jYBHXB"
>
Information in accordance with section 5 TMG
</h3>
<a
class="sc-crXcEl hLNarr"
href="#"
>
Test Name
</a>
<a
class="sc-crXcEl hLNarr"
href="#"
>
Test Address
</a>
<a
class="sc-crXcEl hLNarr"
href="#"
>
Test Email
</a>
<a
class="sc-crXcEl hLNarr"
href="#"
>
Test Phone
</a>
<a
class="sc-crXcEl hLNarr"
href="#"
>
Test URL
</a>
</div>
<div>
<h3
class="sc-dkzDqf sc-kDDrLX dzkwjK jYBHXB"
>
Imprint
</h3>
<p
class="sc-iqcoie fwpsgH"
>
This is a test!
</p>
</div>
</div>
<p
class="sc-papXJ gkwCsw"
data-testid="toggle-button"
>
View Imprint
</p>
</div>
</ul>
</div>
</div>
</body>
`;
exports[`imprint.tsx Tests ImprintField 1`] = `[Function]`;
exports[`imprint.tsx Tests ImprintField 1`] = `
<body>
<div>
<a
class="sc-crXcEl hLNarr"
href="#"
>
Test Name
</a>
</div>
</body>
`;

View file

@ -1,11 +1,195 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`modal.tsx Tests modal with icon 1`] = `[Function]`;
exports[`modal.tsx Tests modal with icon 1`] = `
<body>
<div>
<div
class="sc-ftvSup cpmMIl"
hidden=""
>
<div
class="sc-jqUVSM izDwOx"
>
<h2
class="sc-gsnTZi jiVNCT"
>
Test Modal
</h2>
<button
class="sc-gKXOVf inaviU"
data-testid="close-button"
>
<i
class="sc-iBkjds fflOgg"
>
close
</i>
</button>
</div>
<p>
Hello
</p>
</div>
<button
class="sc-gKXOVf inaviU"
data-testid="toggle-button"
>
<i
class="sc-iBkjds fflOgg"
/>
</button>
</div>
</body>
`;
exports[`modal.tsx Tests modal with icon button 1`] = `[Function]`;
exports[`modal.tsx Tests modal with icon button 1`] = `
<body>
<div>
<div
class="sc-ftvSup cpmMIl"
hidden=""
>
<div
class="sc-jqUVSM izDwOx"
>
<h2
class="sc-gsnTZi jiVNCT"
>
Test Modal
</h2>
<button
class="sc-gKXOVf inaviU"
data-testid="close-button"
>
<i
class="sc-iBkjds fflOgg"
>
close
</i>
</button>
</div>
<p>
Hello
</p>
</div>
<button
class="sc-gKXOVf inaviU"
data-testid="toggle-button"
>
<i
class="sc-iBkjds fflOgg"
>
bug_report
</i>
</button>
</div>
</body>
`;
exports[`modal.tsx Tests modal with neither 1`] = `[Function]`;
exports[`modal.tsx Tests modal with neither 1`] = `
<body>
<div>
<div
class="sc-ftvSup cpmMIl"
hidden=""
>
<div
class="sc-jqUVSM izDwOx"
>
<h2
class="sc-gsnTZi jiVNCT"
>
Test Modal
</h2>
<button
class="sc-gKXOVf inaviU"
data-testid="close-button"
>
<i
class="sc-iBkjds fflOgg"
>
close
</i>
</button>
</div>
<p>
Hello
</p>
</div>
</div>
</body>
`;
exports[`modal.tsx Tests modal with text button 1`] = `[Function]`;
exports[`modal.tsx Tests modal with text button 1`] = `
<body>
<div>
<div
class="sc-ftvSup cpmMIl"
hidden=""
>
<div
class="sc-jqUVSM izDwOx"
>
<h2
class="sc-gsnTZi jiVNCT"
>
Test Modal
</h2>
<button
class="sc-gKXOVf inaviU"
data-testid="close-button"
>
<i
class="sc-iBkjds fflOgg"
>
close
</i>
</button>
</div>
<p>
Hello
</p>
</div>
<p
class="sc-papXJ gkwCsw"
data-testid="toggle-button"
>
Test
</p>
</div>
</body>
`;
exports[`modal.tsx Tests modal without onClose behaviour 1`] = `[Function]`;
exports[`modal.tsx Tests modal without onClose behaviour 1`] = `
<body>
<div>
<div
class="sc-ftvSup cpmMIl"
hidden=""
>
<div
class="sc-jqUVSM izDwOx"
>
<h2
class="sc-gsnTZi jiVNCT"
>
Test Modal
</h2>
<button
class="sc-gKXOVf inaviU"
data-testid="close-button"
>
<i
class="sc-iBkjds fflOgg"
>
close
</i>
</button>
</div>
<p>
Hello
</p>
</div>
</div>
</body>
`;

View file

@ -1,5 +1,41 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`searchBar.tsx Tests SearchBar rendering with properties 1`] = `[Function]`;
exports[`searchBar.tsx Tests SearchBar rendering with properties 1`] = `
<body>
<div>
<form
class="sc-gKXOVf cxXynI"
>
<input
class="sc-iBkjds kzIHQP"
data-testid="search-input"
placeholder=""
type="text"
value=""
/>
<button
class="sc-jSMfEi sc-ftvSup SCCAz eeBQsp"
data-testid="search-clear"
hidden=""
type="button"
>
Clear
</button>
<button
class="sc-jSMfEi sc-ftvSup SCCAz eeBQsp"
data-testid="search-submit"
hidden=""
type="submit"
>
Search
</button>
</form>
</div>
</body>
`;
exports[`searchBar.tsx Tests searchBar rendering without properties 1`] = `[Function]`;
exports[`searchBar.tsx Tests searchBar rendering without properties 1`] = `
<body>
<div />
</body>
`;

View file

@ -1,9 +1,114 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`select.tsx Tests \`current\`-value with testId 1`] = `[Function]`;
exports[`select.tsx Tests \`current\`-value with testId 1`] = `
<body>
<div>
<select
class="sc-bczRLJ laxZOh"
data-testid="select-1"
>
<option
data-testid="option-1-0"
value="0"
>
Test 1
</option>
<option
data-testid="option-1-1"
value="1"
>
Test 2
</option>
</select>
</div>
</body>
`;
exports[`select.tsx Tests \`current\`-value without testId 1`] = `[Function]`;
exports[`select.tsx Tests \`current\`-value without testId 1`] = `
<body>
<div>
<select
class="sc-bczRLJ laxZOh"
data-testid="select"
>
<option
data-testid="option-0"
value="0"
>
Test 1
</option>
<option
data-testid="option-1"
value="1"
>
Test 2
</option>
</select>
</div>
</body>
`;
exports[`select.tsx Tests Select rendering 1`] = `[Function]`;
exports[`select.tsx Tests Select rendering 1`] = `
<body>
<div>
<select
class="sc-bczRLJ laxZOh"
data-testid="select"
>
<option
data-testid="option-0"
value="0"
>
Test 1
</option>
<option
data-testid="option-1"
value="1"
>
Test 2
</option>
</select>
</div>
</body>
`;
exports[`select.tsx Tests rendering of multiple Select elements 1`] = `[Function]`;
exports[`select.tsx Tests rendering of multiple Select elements 1`] = `
<body>
<div>
<select
class="sc-bczRLJ laxZOh"
data-testid="select-1"
>
<option
data-testid="option-1-0"
value="0"
>
Test 1
</option>
<option
data-testid="option-1-1"
value="1"
>
Test 2
</option>
</select>
<select
class="sc-bczRLJ laxZOh"
data-testid="select-2"
>
<option
data-testid="option-2-0"
value="0"
>
Test 1
</option>
<option
data-testid="option-2-1"
value="1"
>
Test 2
</option>
</select>
</div>
</body>
`;

File diff suppressed because it is too large Load diff

View file

@ -10,7 +10,7 @@ const props: IAppProps = {
describe("app.tsx", () => {
it("Tests app rendering with newTab=true", () => {
const { asFragment } = render(
const { baseElement } = render(
<App
name={props.name}
icon={props.icon}
@ -20,11 +20,11 @@ describe("app.tsx", () => {
/>,
);
expect(asFragment).toMatchSnapshot();
expect(baseElement).toMatchSnapshot();
});
it("Tests app rendering with newTab=false", () => {
const { asFragment } = render(
const { baseElement } = render(
<App
name={props.name}
icon={props.icon}
@ -34,11 +34,11 @@ describe("app.tsx", () => {
/>,
);
expect(asFragment).toMatchSnapshot();
expect(baseElement).toMatchSnapshot();
});
it("Tests app rendering without newTab", () => {
const { asFragment } = render(
const { baseElement } = render(
<App
name={props.name}
icon={props.icon}
@ -47,6 +47,6 @@ describe("app.tsx", () => {
/>,
);
expect(asFragment).toMatchSnapshot();
expect(baseElement).toMatchSnapshot();
});
});

View file

@ -22,9 +22,9 @@ const props: IAppCategoryProps = {
};
it("AppCategory snapshot test", () => {
const { asFragment } = render(
const { baseElement } = render(
<AppCategory name={props.name} items={props.items} />,
);
expect(asFragment).toMatchSnapshot();
expect(baseElement).toMatchSnapshot();
});

View file

@ -36,25 +36,25 @@ const props: IAppListProps = {
describe("appList.tsx", () => {
it("Tests AppList rendering with categories and apps", () => {
const { asFragment } = render(
const { baseElement } = render(
<AppList categories={props.categories} apps={props.apps} />,
);
expect(asFragment).toMatchSnapshot();
expect(baseElement).toMatchSnapshot();
});
it("Tests AppList rendering with categories", () => {
const { asFragment } = render(<AppList categories={props.categories} />);
expect(asFragment).toMatchSnapshot();
const { baseElement } = render(<AppList categories={props.categories} />);
expect(baseElement).toMatchSnapshot();
});
it("Tests AppList rendering with apps", () => {
const { asFragment } = render(<AppList apps={props.apps} />);
expect(asFragment).toMatchSnapshot();
const { baseElement } = render(<AppList apps={props.apps} />);
expect(baseElement).toMatchSnapshot();
});
it("Tests AppList rendering with neither", () => {
const { asFragment } = render(<AppList />);
expect(asFragment).toMatchSnapshot();
const { baseElement } = render(<AppList />);
expect(baseElement).toMatchSnapshot();
});
});

View file

@ -50,7 +50,7 @@ describe("app.tsx", () => {
const tests = [true, false];
tests.forEach((test: boolean) => {
const { asFragment } = render(
const { baseElement } = render(
<App
name={appProps.name}
icon={appProps.icon}
@ -60,12 +60,12 @@ describe("app.tsx", () => {
/>,
);
expect(asFragment).toMatchSnapshot();
expect(baseElement).toMatchSnapshot();
});
});
it("Tests App rendering without newTab", () => {
const { asFragment } = render(
const { baseElement } = render(
<App
name={appProps.name}
icon={appProps.icon}
@ -74,26 +74,26 @@ describe("app.tsx", () => {
/>,
);
expect(asFragment).toMatchSnapshot();
expect(baseElement).toMatchSnapshot();
});
it("Tests AppCategory rendering", () => {
appCategoryProps.forEach((appCategory) => {
const { asFragment } = render(
const { baseElement } = render(
<AppCategory name={appCategory.name} items={appCategory.items} />,
);
expect(asFragment).toMatchSnapshot();
expect(baseElement).toMatchSnapshot();
});
});
it("Tests AppList rendering", () => {
appListProps.forEach((appList) => {
const { asFragment } = render(
const { baseElement } = render(
<AppList apps={appList.apps} categories={appList.categories} />,
);
expect(asFragment).toMatchSnapshot();
expect(baseElement).toMatchSnapshot();
});
});
});

View file

@ -22,44 +22,44 @@ const bookmarkListProps: IBookmarkListProps = {
it("tests rendering of Bookmark with newTab=true", () => {
let props = bookmarkGroupProps.items[0];
const { asFragment } = render(
const { baseElement } = render(
<Bookmark name={props.name} url={props.url} newTab={true} />,
);
expect(asFragment).toMatchSnapshot();
expect(baseElement).toMatchSnapshot();
});
it("tests rendering of Bookmark with newTab=false", () => {
let props = bookmarkGroupProps.items[0];
const { asFragment } = render(
const { baseElement } = render(
<Bookmark name={props.name} url={props.url} newTab={false} />,
);
expect(asFragment).toMatchSnapshot();
expect(baseElement).toMatchSnapshot();
});
it("tests rendering of Bookmark without newTab", () => {
let props = bookmarkGroupProps.items[0];
const { asFragment } = render(<Bookmark name={props.name} url={props.url} />);
const { baseElement } = render(<Bookmark name={props.name} url={props.url} />);
expect(asFragment).toMatchSnapshot();
expect(baseElement).toMatchSnapshot();
});
it("tests rendering of BookmarkGroup", () => {
const { asFragment } = render(
const { baseElement } = render(
<BookmarkGroup
name={bookmarkGroupProps.name}
items={bookmarkGroupProps.items}
/>,
);
expect(asFragment).toMatchSnapshot();
expect(baseElement).toMatchSnapshot();
});
it("tests rendering of BookmarkList", () => {
const { asFragment } = render(
const { baseElement } = render(
<BookmarkList groups={bookmarkListProps.groups} />,
);
expect(asFragment).toMatchSnapshot();
expect(baseElement).toMatchSnapshot();
});

View file

@ -99,11 +99,11 @@ it("getExtension test", () => {
});
it("Greeter snapshot test with properties", () => {
const { asFragment } = render(<Greeter greeter={{ greeter: props }} />);
expect(asFragment).toMatchSnapshot();
const { baseElement } = render(<Greeter greeter={{ greeter: props }} />);
expect(baseElement).toMatchSnapshot();
});
it("Greeter snapshot test without properties", () => {
const { asFragment } = render(<Greeter />);
expect(asFragment).toMatchSnapshot();
const { baseElement } = render(<Greeter />);
expect(baseElement).toMatchSnapshot();
});

View file

@ -8,13 +8,13 @@ const props = {
};
it("Icon test", () => {
const { asFragment } = render(<Icon name={props.name} size={props.size} />);
expect(asFragment).toMatchSnapshot();
const { baseElement } = render(<Icon name={props.name} size={props.size} />);
expect(baseElement).toMatchSnapshot();
});
it("Icon test (no size)", () => {
const { asFragment } = render(<Icon name={props.name} />);
expect(asFragment).toMatchSnapshot();
const { baseElement } = render(<Icon name={props.name} />);
expect(baseElement).toMatchSnapshot();
});
it("IconButton test", () => {
@ -22,7 +22,7 @@ it("IconButton test", () => {
<IconButton icon={props.name} onClick={props.onClick} />,
);
expect(iconButton.asFragment).toMatchSnapshot();
expect(iconButton.baseElement).toMatchSnapshot();
fireEvent.click(screen.getByText(/bug_report/i));
expect(props.onClick).toHaveBeenCalledTimes(1);

View file

@ -43,8 +43,8 @@ describe("imprint.tsx", () => {
});
it("Tests Imprint", () => {
const { asFragment } = render(<Imprint imprint={props} />);
expect(asFragment).toMatchSnapshot();
const { baseElement } = render(<Imprint imprint={props} />);
expect(baseElement).toMatchSnapshot();
});
it("Tests onClose with #imprint", () => {
@ -61,7 +61,7 @@ describe("imprint.tsx", () => {
});
it("Tests ImprintField", () => {
const { asFragment } = render(<ImprintField field={props.name} />);
expect(asFragment).toMatchSnapshot();
const { baseElement } = render(<ImprintField field={props.name} />);
expect(baseElement).toMatchSnapshot();
});
});

View file

@ -49,7 +49,7 @@ const setup = (props: IModalProps) => {
describe("modal.tsx", () => {
it("Tests modal with icon button", () => {
const modal = setup(iconProps);
expect(modal.asFragment).toMatchSnapshot();
expect(modal.baseElement).toMatchSnapshot();
fireEvent.click(modal.getByTestId("toggle-button"));
fireEvent.click(modal.getByTestId("close-button"));
expect(iconProps.onClose).toHaveBeenCalledTimes(2);
@ -57,7 +57,7 @@ describe("modal.tsx", () => {
it("Tests modal with text button", () => {
const modal = setup(textProps);
expect(modal.asFragment).toMatchSnapshot();
expect(modal.baseElement).toMatchSnapshot();
fireEvent.click(modal.getByTestId("toggle-button"));
fireEvent.click(modal.getByTestId("close-button"));
expect(textProps.onClose).toHaveBeenCalledTimes(2);
@ -65,12 +65,12 @@ describe("modal.tsx", () => {
it("Tests modal with neither", () => {
const modal = setup(noneProps);
expect(modal.asFragment).toMatchSnapshot();
expect(modal.baseElement).toMatchSnapshot();
});
it("Tests modal with icon", () => {
const modal = setup(invalidIconProps);
expect(modal.asFragment).toMatchSnapshot();
expect(modal.baseElement).toMatchSnapshot();
fireEvent.click(modal.getByTestId("toggle-button"));
fireEvent.click(modal.getByTestId("close-button"));
expect(invalidIconProps.onClose).toHaveBeenCalledTimes(2);
@ -78,7 +78,7 @@ describe("modal.tsx", () => {
it("Tests modal without onClose behaviour", () => {
const modal = setup(noneProps);
expect(modal.asFragment).toMatchSnapshot();
expect(modal.baseElement).toMatchSnapshot();
fireEvent.click(modal.getByTestId("close-button"));
expect(iconProps.onClose).toHaveBeenCalledTimes(0);
});

View file

@ -56,12 +56,12 @@ describe("searchBar.tsx", () => {
it("Tests SearchBar rendering with properties", () => {
const { searchBar } = setup();
expect(searchBar.asFragment).toMatchSnapshot();
expect(searchBar.baseElement).toMatchSnapshot();
});
it("Tests searchBar rendering without properties", () => {
const searchBar = render(<SearchBar />);
expect(searchBar.asFragment).toMatchSnapshot();
expect(searchBar.baseElement).toMatchSnapshot();
});
it("Tests handleQueryWithProvider", () => {

View file

@ -15,15 +15,15 @@ const items: Array<IItemProps> = [
describe("select.tsx", () => {
it("Tests Select rendering", () => {
const { asFragment } = render(
const { baseElement } = render(
<Select items={items} onChange={(item) => onChange(item)}></Select>,
);
expect(asFragment).toMatchSnapshot();
expect(baseElement).toMatchSnapshot();
});
it("Tests rendering of multiple Select elements", () => {
const { asFragment } = render(
const { baseElement } = render(
<>
<Select
testId="1"
@ -38,7 +38,7 @@ describe("select.tsx", () => {
</>,
);
expect(asFragment).toMatchSnapshot();
expect(baseElement).toMatchSnapshot();
});
it("Tests Select onChange", () => {
@ -60,7 +60,7 @@ describe("select.tsx", () => {
});
it("Tests `current`-value without testId", () => {
const { asFragment } = render(
const { baseElement } = render(
<Select
current={items[1].label}
items={items}
@ -68,11 +68,11 @@ describe("select.tsx", () => {
></Select>,
);
expect(asFragment).toMatchSnapshot();
expect(baseElement).toMatchSnapshot();
});
it("Tests `current`-value with testId", () => {
const { asFragment } = render(
const { baseElement } = render(
<Select
current={items[1].label}
testId="1"
@ -81,6 +81,6 @@ describe("select.tsx", () => {
></Select>,
);
expect(asFragment).toMatchSnapshot();
expect(baseElement).toMatchSnapshot();
});
});

View file

@ -85,12 +85,12 @@ describe("settings.tsx", () => {
});
it("Tests forms", () => {
const { asFragment } = render(<FormContainer />);
expect(asFragment).toMatchSnapshot();
const { baseElement } = render(<FormContainer />);
expect(baseElement).toMatchSnapshot();
});
it("Tests tables", () => {
const { asFragment } = render(
const { baseElement } = render(
<Table>
<tbody>
<TableRow>
@ -103,26 +103,26 @@ describe("settings.tsx", () => {
</Table>,
);
expect(asFragment).toMatchSnapshot();
expect(baseElement).toMatchSnapshot();
});
it("Tests sections", () => {
const { asFragment } = render(
const { baseElement } = render(
<Section>
<SectionHeadline>Test</SectionHeadline>
</Section>,
);
expect(asFragment).toMatchSnapshot();
expect(baseElement).toMatchSnapshot();
});
it("Tests settings rendering", () => {
propsList.forEach((props) => {
const { asFragment } = render(
const { baseElement } = render(
<Settings themes={props.themes} search={props.search} />,
);
expect(asFragment).toMatchSnapshot();
expect(baseElement).toMatchSnapshot();
});
});