-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
606 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { render } from '@testing-library/preact' | ||
import ClipboardSuggestion from 'Popup/ClipboardSuggestion' | ||
import Clipboard from 'utils/Clipboard' | ||
import OptionsStorage from 'utils/OptionsStorage' | ||
|
||
jest.mock(`utils/Clipboard`) | ||
const getPopupSearchText = Clipboard.getPopupSearchText as jest.Mock | ||
|
||
jest.mock(`utils/OptionsStorage`) | ||
const clipboardPasteGet = OptionsStorage.clipboardPaste.get as jest.Mock | ||
|
||
const QUERY = `abc123` | ||
const CLIPBOARD_TEXT = `xyz789` | ||
const applyClipboardText = () => {} | ||
|
||
describe(`ExternalLinks`, () => { | ||
it(`renders without error`, () => { | ||
getPopupSearchText.mockImplementation(() => Promise.resolve(CLIPBOARD_TEXT)) | ||
clipboardPasteGet.mockImplementation(() => Promise.resolve(true)) | ||
const tree = render( | ||
<ClipboardSuggestion | ||
query={QUERY} | ||
applyClipboardText={applyClipboardText} | ||
/>, | ||
) | ||
expect(tree).toMatchSnapshot() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { render } from '@testing-library/preact' | ||
import ExternalLinks from 'Popup/ExternalLinks' | ||
import { Constants } from 'utils' | ||
import OptionsStorage from 'utils/OptionsStorage' | ||
import SearcherStorage from 'ContentScript/Searcher/SearcherStorage' | ||
|
||
jest.mock(`utils/OptionsStorage`) | ||
const institutionalLoginGet = OptionsStorage.institutionalLogin.get as jest.Mock | ||
|
||
jest.mock(`ContentScript/Searcher/SearcherStorage`) | ||
const storeLawNetQuery = SearcherStorage.storeLawNetQuery as jest.Mock | ||
|
||
const TYPE: Law.Type = `case-name` | ||
const QUERY = `abc123` | ||
|
||
describe(`ExternalLinks`, () => { | ||
|
||
beforeAll(() => { | ||
institutionalLoginGet.mockImplementation(() => Promise.resolve(`None`)) | ||
storeLawNetQuery.mockImplementation(() => Promise.resolve()) | ||
}) | ||
|
||
it(`renders without error for UK`, () => { | ||
const tree = render( | ||
<ExternalLinks | ||
jurisdiction={Constants.JURISDICTIONS.UK.id} | ||
type={TYPE} | ||
query={QUERY} | ||
/>, | ||
) | ||
expect(tree).toMatchSnapshot() | ||
}) | ||
|
||
it(`renders without error for Singapore`, () => { | ||
const tree = render( | ||
<ExternalLinks | ||
jurisdiction={Constants.JURISDICTIONS.SG.id} | ||
type={TYPE} | ||
query={QUERY} | ||
/>, | ||
) | ||
expect(tree).toMatchSnapshot() | ||
}) | ||
|
||
it(`renders without error for EU`, () => { | ||
const tree = render( | ||
<ExternalLinks | ||
jurisdiction={Constants.JURISDICTIONS.EU.id} | ||
type={TYPE} | ||
query={QUERY} | ||
/>, | ||
) | ||
expect(tree).toMatchSnapshot() | ||
}) | ||
}) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
62 changes: 62 additions & 0 deletions
62
src/Popup/__tests__/__snapshots__/ClipboardSuggestion.test.tsx.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`ExternalLinks renders without error 1`] = ` | ||
Object { | ||
"asFragment": [Function], | ||
"baseElement": <body> | ||
<div /> | ||
</body>, | ||
"container": <div />, | ||
"debug": [Function], | ||
"findAllByAltText": [Function], | ||
"findAllByDisplayValue": [Function], | ||
"findAllByLabelText": [Function], | ||
"findAllByPlaceholderText": [Function], | ||
"findAllByRole": [Function], | ||
"findAllByTestId": [Function], | ||
"findAllByText": [Function], | ||
"findAllByTitle": [Function], | ||
"findByAltText": [Function], | ||
"findByDisplayValue": [Function], | ||
"findByLabelText": [Function], | ||
"findByPlaceholderText": [Function], | ||
"findByRole": [Function], | ||
"findByTestId": [Function], | ||
"findByText": [Function], | ||
"findByTitle": [Function], | ||
"getAllByAltText": [Function], | ||
"getAllByDisplayValue": [Function], | ||
"getAllByLabelText": [Function], | ||
"getAllByPlaceholderText": [Function], | ||
"getAllByRole": [Function], | ||
"getAllByTestId": [Function], | ||
"getAllByText": [Function], | ||
"getAllByTitle": [Function], | ||
"getByAltText": [Function], | ||
"getByDisplayValue": [Function], | ||
"getByLabelText": [Function], | ||
"getByPlaceholderText": [Function], | ||
"getByRole": [Function], | ||
"getByTestId": [Function], | ||
"getByText": [Function], | ||
"getByTitle": [Function], | ||
"queryAllByAltText": [Function], | ||
"queryAllByDisplayValue": [Function], | ||
"queryAllByLabelText": [Function], | ||
"queryAllByPlaceholderText": [Function], | ||
"queryAllByRole": [Function], | ||
"queryAllByTestId": [Function], | ||
"queryAllByText": [Function], | ||
"queryAllByTitle": [Function], | ||
"queryByAltText": [Function], | ||
"queryByDisplayValue": [Function], | ||
"queryByLabelText": [Function], | ||
"queryByPlaceholderText": [Function], | ||
"queryByRole": [Function], | ||
"queryByTestId": [Function], | ||
"queryByText": [Function], | ||
"queryByTitle": [Function], | ||
"rerender": [Function], | ||
"unmount": [Function], | ||
} | ||
`; |
Oops, something went wrong.