2020-03-24 16:07:04 +03:00
|
|
|
import React from 'react';
|
2020-04-10 18:32:37 +03:00
|
|
|
import {render} from '@testing-library/react';
|
2020-09-23 20:59:16 +03:00
|
|
|
import {site} from './utils/fixtures';
|
2020-03-24 16:07:04 +03:00
|
|
|
import App from './App';
|
|
|
|
|
2020-06-12 11:21:00 +03:00
|
|
|
const setup = (overrides) => {
|
|
|
|
const testState = {
|
|
|
|
site,
|
2020-09-23 18:07:59 +03:00
|
|
|
member: null,
|
2020-06-12 11:21:00 +03:00
|
|
|
action: 'init:success',
|
2020-07-07 17:23:26 +03:00
|
|
|
brandColor: site.accent_color,
|
2020-06-12 11:21:00 +03:00
|
|
|
page: 'signup',
|
|
|
|
initStatus: 'success',
|
|
|
|
showPopup: true
|
|
|
|
};
|
|
|
|
const {...utils} = render(
|
|
|
|
<App testState={testState} />
|
2020-04-15 18:45:56 +03:00
|
|
|
);
|
2021-03-19 10:05:57 +03:00
|
|
|
const triggerButtonFrame = utils.getByTitle(/portal-trigger/i);
|
|
|
|
const popupFrame = utils.getByTitle(/portal-popup/i);
|
2020-06-12 11:21:00 +03:00
|
|
|
return {
|
|
|
|
popupFrame,
|
|
|
|
triggerButtonFrame,
|
|
|
|
...utils
|
|
|
|
};
|
|
|
|
};
|
2020-04-15 18:45:56 +03:00
|
|
|
|
2020-06-12 11:21:00 +03:00
|
|
|
describe('App', () => {
|
|
|
|
test('renders popup and trigger frames', () => {
|
|
|
|
const {popupFrame, triggerButtonFrame} = setup();
|
|
|
|
|
|
|
|
expect(popupFrame).toBeInTheDocument();
|
|
|
|
expect(triggerButtonFrame).toBeInTheDocument();
|
|
|
|
});
|
2020-04-15 18:45:56 +03:00
|
|
|
});
|