From 402e64f1ba13c38cdb9b48787adddd544769a14f Mon Sep 17 00:00:00 2001 From: Justin Shreve Date: Tue, 2 Jul 2019 15:30:03 -0400 Subject: [PATCH] Fix tests, and adjust auto auth behavior to only launch with the new flow. --- client/blocks/login/login-form.jsx | 2 -- client/blocks/signup-form/index.jsx | 2 +- client/jetpack-connect/authorize.js | 4 +++- .../test/__snapshots__/authorize.js.snap | 1 + client/jetpack-connect/test/authorize.js | 17 +++++++++++------ 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/client/blocks/login/login-form.jsx b/client/blocks/login/login-form.jsx index 61638119fe6fc..90ea6f22c0f46 100644 --- a/client/blocks/login/login-form.jsx +++ b/client/blocks/login/login-form.jsx @@ -289,8 +289,6 @@ export class LoginForm extends Component { return (
- { this.renderPrivateSiteNotice() } - { this.renderPrivateSiteNotice() }
diff --git a/client/blocks/signup-form/index.jsx b/client/blocks/signup-form/index.jsx index f3ec459b8f962..dd80287465d10 100644 --- a/client/blocks/signup-form/index.jsx +++ b/client/blocks/signup-form/index.jsx @@ -889,7 +889,7 @@ class SignupForm extends Component { { this.props.isSocialSignupEnabled && ! this.userCreationComplete() && ( diff --git a/client/jetpack-connect/authorize.js b/client/jetpack-connect/authorize.js index 1c883771106dc..ddd881c6abab7 100644 --- a/client/jetpack-connect/authorize.js +++ b/client/jetpack-connect/authorize.js @@ -259,7 +259,9 @@ export class JetpackAuthorize extends Component { const { alreadyAuthorized, authApproved, from } = this.props.authQuery; return ( this.isSso() || - 'woocommerce-services-auto-authorize' === from || + ( 'woocommerce-services-auto-authorize' === from || + ( ! config.isEnabled( 'jetpack/connect/woocommerce' ) && + 'woocommerce-setup-wizard' === ' from' ) ) || ( ! this.props.isAlreadyOnSitesList && ! alreadyAuthorized && ( this.props.calypsoStartedConnection || authApproved ) ) diff --git a/client/jetpack-connect/test/__snapshots__/authorize.js.snap b/client/jetpack-connect/test/__snapshots__/authorize.js.snap index 23686d34205f4..88b72d91c9a7c 100644 --- a/client/jetpack-connect/test/__snapshots__/authorize.js.snap +++ b/client/jetpack-connect/test/__snapshots__/authorize.js.snap @@ -84,6 +84,7 @@ exports[`JetpackAuthorize renders as expected 1`] = ` Sign in as a different user diff --git a/client/jetpack-connect/test/authorize.js b/client/jetpack-connect/test/authorize.js index 90b8d81ace701..940b10a17819d 100644 --- a/client/jetpack-connect/test/authorize.js +++ b/client/jetpack-connect/test/authorize.js @@ -123,12 +123,12 @@ describe( 'JetpackAuthorize', () => { describe( 'isWoo', () => { const isWoo = new JetpackAuthorize().isWoo; - test( 'should return true for woo wizard', () => { + test( 'should return true for woo services', () => { const props = { authQuery: { from: 'woocommerce-services-auto-authorize' } }; expect( isWoo( props ) ).toBe( true ); } ); - test( 'should return true for woo services', () => { + test( 'should return true for woo wizard', () => { const props = { authQuery: { from: 'woocommerce-setup-wizard' } }; expect( isWoo( props ) ).toBe( true ); } ); @@ -140,9 +140,8 @@ describe( 'JetpackAuthorize', () => { } ); describe( 'shouldAutoAuthorize', () => { - const renderableComponent = ; - test( 'should return true for sso', () => { + const renderableComponent = ; const component = shallow( renderableComponent ); component.instance().isSso = () => true; const result = component.instance().shouldAutoAuthorize(); @@ -150,9 +149,15 @@ describe( 'JetpackAuthorize', () => { expect( result ).toBe( true ); } ); - test( 'should return true for woo', () => { + test( 'should return true for woo services', () => { + const renderableComponent = ; const component = shallow( renderableComponent ); - component.instance().isWoo = () => true; + component.setProps( { + authQuery: { + ...DEFAULT_PROPS.authQuery, + from: 'woocommerce-services-auto-authorize', + }, + } ); const result = component.instance().shouldAutoAuthorize(); expect( result ).toBe( true );