0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-04-01 02:41:39 -05:00

Switched to recommended absolute test-utils path setup

refs https://github.com/TryGhost/members.js/issues/5

Switched to using absolute path for default test-utils setup file as relative imports become too messy when we keep tests for a component next to it. This setup allows using absolute path for common test-utils file which is used in almost all tests for initial setup.
This commit is contained in:
Rish 2020-04-28 23:29:56 +05:30
parent d83382ffb5
commit 7da315acba
5 changed files with 5 additions and 6 deletions

1
ghost/portal/.env Normal file
View file

@ -0,0 +1 @@
NODE_PATH=src/utils

View file

@ -1,14 +1,12 @@
import React from 'react';
import {render, fireEvent} from '../../utils/tests';
import {render, fireEvent} from 'test-utils';
import AccountHomePage from './AccountHomePage';
import {member} from '../../utils/fixtures';
const setup = (overrides) => {
const freeMember = member.free;
const {mockOnActionFn, ...utils} = render(
<AccountHomePage />
);
const memberEmail = utils.getByText(freeMember.email);
const memberEmail = utils.getByText('member@example.com');
const logoutButton = utils.queryByRole('button', {name: 'Log out'});
return {
memberEmail,

View file

@ -1,5 +1,5 @@
import React from 'react';
import {render, fireEvent} from '../../utils/tests';
import {render, fireEvent} from 'test-utils';
import SigninPage from './SigninPage';
const setup = (overrides) => {

View file

@ -1,6 +1,6 @@
import React from 'react';
import SignupPage from './SignupPage';
import {render, fireEvent} from '../../utils/tests';
import {render, fireEvent} from 'test-utils';
const setup = (overrides) => {
const {mockOnActionFn, ...utils} = render(