import { tourBranching } from '../tour-branching'; describe( 'Guided Tours Branching', () => { test( 'tourBranching returns a branch tree for a tour JSX tree', () => { // We are testing just a tree of elements created by React.createElement. The actual // component types don't matter (never rendered) and can be null. const Fragment = 'Fragment'; const Tour = 'Tour'; const Step = 'Step'; const ButtonRow = 'ButtonRow'; const SiteLink = 'SiteLink'; // These components have `step` props and are checked for `displayName` and `name` const Continue = () => null; const Next = () => null; const tourTree = ( { ( { translate } ) => (

{ translate( 'It’s time to get your blog rolling with your first post.' ) }

{ translate( 'All done, continue' ) } { translate( 'Return to the checklist' ) }
) }
{ ( { translate } ) => (

{ translate( 'Categories and Tags' ) }

{ translate( 'All done, continue' ) }
) }
{ ( { translate } ) => (

{ translate( 'Press anywhere on this image so we can change it.' ) }

) }
{ ( { translate } ) => (

{ translate( 'Either pick an image below or add a new one.' ) }

{ translate( 'All done, continue' ) }
) }
{ ( { translate } ) => ( { translate( 'We’re all set' ) } ) } { ( { translate } ) => ( { translate( 'Almost done' ) } ) } { ( { translate } ) => (

{ translate( 'You published your first blog post.' ) }

) }
); expect( tourBranching( tourTree ) ).toEqual( { init: { next: 'categories-tags', continue: 'categories-tags', }, 'categories-tags': { next: 'featured-images', }, 'featured-images': { continue: 'choose-image', }, 'choose-image': { next: 'click-set-featured-image', }, 'click-set-featured-image': { continue: 'click-update', }, 'click-update': { continue: 'finish', }, finish: {}, } ); } ); } );