|
| 1 | +import React from 'react'; |
| 2 | + |
| 3 | +import { render, screen } from '../../../test-utils'; |
| 4 | + |
| 5 | +import ErrorModal from './ErrorModal'; |
| 6 | + |
| 7 | +jest.mock('../../../i18n'); |
| 8 | + |
| 9 | +describe('<ErrorModal />', () => { |
| 10 | + it('renders type forceAuthentication', () => { |
| 11 | + render(<ErrorModal type="forceAuthentication" closeModal={jest.fn()} />); |
| 12 | + |
| 13 | + expect(screen.getByText('Login')).toBeVisible(); |
| 14 | + expect(screen.getByText('Sign Up')).toBeVisible(); |
| 15 | + }); |
| 16 | + |
| 17 | + it('renders type staleSession', () => { |
| 18 | + render(<ErrorModal type="staleSession" closeModal={jest.fn()} />); |
| 19 | + |
| 20 | + expect(screen.getByText('log in')).toBeVisible(); |
| 21 | + }); |
| 22 | + |
| 23 | + it('renders type staleProject', () => { |
| 24 | + render(<ErrorModal type="staleProject" closeModal={jest.fn()} />); |
| 25 | + |
| 26 | + expect( |
| 27 | + screen.getByText( |
| 28 | + 'The project you have attempted to save has been saved from another window', |
| 29 | + { exact: false } |
| 30 | + ) |
| 31 | + ).toBeVisible(); |
| 32 | + }); |
| 33 | + |
| 34 | + it('renders type oauthError with service google', () => { |
| 35 | + render( |
| 36 | + <ErrorModal type="oauthError" service="google" closeModal={jest.fn()} /> |
| 37 | + ); |
| 38 | + |
| 39 | + expect( |
| 40 | + screen.getByText('There was a problem linking your Google account', { |
| 41 | + exact: false |
| 42 | + }) |
| 43 | + ).toBeVisible(); |
| 44 | + }); |
| 45 | + |
| 46 | + it('renders type oauthError with service github', () => { |
| 47 | + render( |
| 48 | + <ErrorModal type="oauthError" service="github" closeModal={jest.fn()} /> |
| 49 | + ); |
| 50 | + |
| 51 | + expect( |
| 52 | + screen.getByText('There was a problem linking your GitHub account', { |
| 53 | + exact: false |
| 54 | + }) |
| 55 | + ).toBeVisible(); |
| 56 | + }); |
| 57 | +}); |
0 commit comments