-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into test-SSOLogin
- Loading branch information
Showing
5 changed files
with
75 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { render, screen } from '@folio/jest-config-stripes/testing-library/react'; | ||
|
||
import BadRequestScreen from './BadRequestScreen'; | ||
|
||
jest.mock('../../Pluggable', () => (props) => props.children); | ||
|
||
describe('BadRequestScreen', () => { | ||
it('renders expected message', () => { | ||
render(<BadRequestScreen />); | ||
|
||
screen.getByText('stripes-core.front.error.header'); | ||
screen.getByText(/stripes-core.front.error.general.message/); | ||
}); | ||
}); | ||
|
||
|
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
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,33 @@ | ||
import { render, screen } from '@folio/jest-config-stripes/testing-library/react'; | ||
|
||
import { useStripes } from '../../StripesContext'; | ||
import Stripes from '../../Stripes'; | ||
import IfInterface from './IfInterface'; | ||
|
||
jest.mock('../../StripesContext'); | ||
const stripes = new Stripes({ | ||
discovery: { | ||
interfaces: { | ||
foo: '1.0' | ||
} | ||
}, | ||
logger: { | ||
log: jest.fn(), | ||
} | ||
}); | ||
|
||
// IfInterface is just a component version of Stripes::hasInterface | ||
// See more extensive tests there. | ||
describe('IfInterface', () => { | ||
it('returns true if interface is present', () => { | ||
useStripes.mockReturnValue(stripes); | ||
render(<IfInterface name="foo">monkey</IfInterface>); | ||
expect(screen.queryByText(/monkey/)).toBeTruthy(); | ||
}); | ||
|
||
it('returns false if interface is absent', () => { | ||
useStripes.mockReturnValue(stripes); | ||
render(<IfInterface name="paul,is,dead">monkey</IfInterface>); | ||
expect(screen.queryByText(/monkey/)).toBeFalsy(); | ||
}); | ||
}); |
14 changes: 14 additions & 0 deletions
14
src/components/ResetPasswordNotAvailableScreen/ResetPasswordNotAvailableScreen.test.js
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,14 @@ | ||
import { render, screen } from '@folio/jest-config-stripes/testing-library/react'; | ||
|
||
import BadRequestScreen from './ResetPasswordNotAvailableScreen'; | ||
|
||
jest.mock('../../Pluggable', () => (props) => props.children); | ||
|
||
describe('ResetPasswordNotAvailableScreen', () => { | ||
it('renders expected message', () => { | ||
render(<BadRequestScreen />); | ||
|
||
screen.getByText('stripes-core.front.error.header'); | ||
screen.getByText('stripes-core.front.error.setPassword.message'); | ||
}); | ||
}); |
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