|
@@ -5,8 +5,18 @@ import {initializeOrg} from 'sentry-test/initializeOrg';
|
|
|
import {render, screen} from 'sentry-test/reactTestingLibrary';
|
|
|
|
|
|
import ConfigStore from 'sentry/stores/configStore';
|
|
|
+import HookStore from 'sentry/stores/hookStore';
|
|
|
import App from 'sentry/views/app';
|
|
|
|
|
|
+function HookWrapper(props) {
|
|
|
+ return (
|
|
|
+ <div data-test-id="hook-wrapper">
|
|
|
+ {props.children}
|
|
|
+ <span>{JSON.stringify(props?.organization ?? {}, null, 2)}</span>
|
|
|
+ </div>
|
|
|
+ );
|
|
|
+}
|
|
|
+
|
|
|
describe('App', function () {
|
|
|
const configState = ConfigStore.getState();
|
|
|
const {routerProps} = initializeOrg();
|
|
@@ -15,6 +25,8 @@ describe('App', function () {
|
|
|
ConfigStore.init();
|
|
|
ConfigStore.loadInitialData(configState);
|
|
|
|
|
|
+ HookStore.init();
|
|
|
+
|
|
|
MockApiClient.addMockResponse({
|
|
|
url: '/organizations/',
|
|
|
body: [OrganizationFixture({slug: 'billy-org', name: 'billy org'})],
|
|
@@ -66,25 +78,29 @@ describe('App', function () {
|
|
|
user.flags.newsletter_consent_prompt = false;
|
|
|
});
|
|
|
|
|
|
- it('renders PartnershipAgreement', async function () {
|
|
|
+ it('renders PartnershipAgreement', function () {
|
|
|
ConfigStore.set('partnershipAgreementPrompt', {partnerDisplayName: 'Foo', agreements:['standard', 'partner_presence']});
|
|
|
+ HookStore.add(
|
|
|
+ 'component:partnership-agreement',
|
|
|
+ () =>
|
|
|
+ <HookWrapper key={0}/>
|
|
|
+ );
|
|
|
render(
|
|
|
<App {...routerProps}>
|
|
|
<div>placeholder content</div>
|
|
|
</App>
|
|
|
);
|
|
|
-
|
|
|
- expect(
|
|
|
- await screen.findByText(/This organization is created in partnership with Foo/)
|
|
|
- ).toBeInTheDocument();
|
|
|
- expect(
|
|
|
- await screen.findByText(/and are aware of the partner's presence in the organization as a manager./)
|
|
|
- ).toBeInTheDocument();
|
|
|
- expect(screen.queryByText('placeholder content')).not.toBeInTheDocument();
|
|
|
+ expect(HookStore.get('component:partnership-agreement')).toHaveLength(1);
|
|
|
+ expect(screen.getByTestId('hook-wrapper')).toBeInTheDocument();
|
|
|
});
|
|
|
|
|
|
- it('does not render PartnerAgreement for non-partnered orgs', async function () {
|
|
|
+ it('does not render PartnerAgreement for non-partnered orgs', function () {
|
|
|
ConfigStore.set('partnershipAgreementPrompt', null);
|
|
|
+ HookStore.add(
|
|
|
+ 'component:partnership-agreement',
|
|
|
+ () =>
|
|
|
+ <HookWrapper key={0}/>
|
|
|
+ );
|
|
|
render(
|
|
|
<App {...routerProps}>
|
|
|
<div>placeholder content</div>
|
|
@@ -92,7 +108,7 @@ describe('App', function () {
|
|
|
);
|
|
|
|
|
|
expect(screen.getByText('placeholder content')).toBeInTheDocument();
|
|
|
- expect(await screen.queryByText(/This organization is created in partnership/)).not.toBeInTheDocument();
|
|
|
+ expect(screen.queryByTestId('hook-wrapper')).not.toBeInTheDocument();
|
|
|
});
|
|
|
|
|
|
it('renders InstallWizard for self-hosted', async function () {
|