This repository has been archived by the owner on Nov 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use react-testing-library for detailed unit tests (#316)
* feat: use react-testing-library for tests * feat: update tests for Subscriptions * feat: update tests for NotFoundPage * feat: update tests for ManageSubscriptions * feat: update tests for OrdersandSubscriptions
- Loading branch information
1 parent
9fca857
commit d514c60
Showing
18 changed files
with
1,112 additions
and
1,186 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -1,20 +1,15 @@ | ||
import React from 'react'; | ||
import renderer from 'react-test-renderer'; | ||
import { IntlProvider } from '@edx/frontend-platform/i18n'; | ||
import { render } from '../testing'; | ||
|
||
import NotFoundPage from './NotFoundPage'; | ||
|
||
describe('<NotFoundPage />', () => { | ||
describe('Renders NotFoundPage', () => { | ||
it('renders not found page', () => { | ||
const tree = renderer | ||
.create(( | ||
<IntlProvider locale="en"> | ||
<NotFoundPage /> | ||
</IntlProvider> | ||
)) | ||
.toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
it('Renders not found message', () => { | ||
const { getByText } = render(<NotFoundPage />); | ||
expect( | ||
getByText( | ||
"The page you're looking for is unavailable or there's an error in the URL. Please check the URL and try again.", | ||
), | ||
).toBeInTheDocument(); | ||
}); | ||
}); |
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,23 @@ | ||
import React from 'react'; | ||
import { render } from '../testing'; | ||
|
||
import SupportLink from './SupportLink'; | ||
|
||
jest.mock('@edx/frontend-platform', () => ({ | ||
getConfig: () => ({ | ||
SUPPORT_URL: 'https://example.com/support', | ||
}), | ||
})); | ||
|
||
describe('<SupportLink />', () => { | ||
it('Renders support link', () => { | ||
const { getByText } = render(<SupportLink />); | ||
|
||
const contactSupportLink = getByText('contact support'); | ||
expect(contactSupportLink).toBeInTheDocument(); | ||
expect(contactSupportLink).toHaveAttribute( | ||
'href', | ||
'https://example.com/support/hc/requests/new', | ||
); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.