Skip to content

Commit

Permalink
📸 Add Snapshot for ReloadInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
0x46616c6b committed Mar 28, 2022
1 parent d4c16eb commit e90ba40
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/components/ReloadInfo.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React from 'react'
import { render } from '@testing-library/react'
import { ReloadInfo } from './index'

describe('ReloadInfo', function () {
beforeAll(function () {
localStorage.removeItem('showReloadInfo')
})

test('renders correctly', function () {
const { asFragment } = render(<ReloadInfo />)

expect(asFragment()).toMatchSnapshot()
})

test('not renders if dismissed', function () {
localStorage.setItem('showReloadInfo', '0')
const { asFragment } = render(<ReloadInfo />)

expect(asFragment()).toMatchSnapshot()
})
})
59 changes: 59 additions & 0 deletions src/components/__snapshots__/ReloadInfo.test.tsx.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`ReloadInfo not renders if dismissed 1`] = `
<DocumentFragment>
<div
class="ui teal hidden icon message"
>
<i
aria-hidden="true"
class="close icon"
/>
<i
aria-hidden="true"
class="info icon"
/>
<div
class="content"
>
<div
class="header"
>
Information
</div>
<p>
The messages update automatically. There is no need to reload the entire page.
</p>
</div>
</div>
</DocumentFragment>
`;

exports[`ReloadInfo renders correctly 1`] = `
<DocumentFragment>
<div
class="ui teal icon message"
>
<i
aria-hidden="true"
class="close icon"
/>
<i
aria-hidden="true"
class="info icon"
/>
<div
class="content"
>
<div
class="header"
>
Information
</div>
<p>
The messages update automatically. There is no need to reload the entire page.
</p>
</div>
</div>
</DocumentFragment>
`;

0 comments on commit e90ba40

Please sign in to comment.