File size: 1,219 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import { shouldRedirectToSiteMigration } from '..';
import { STEPS } from '../../internals/steps';
describe( 'DeclarativeFlowHelpers', () => {
	it( 'returns true when current step, platform and origin as set properly', () => {
		expect(
			shouldRedirectToSiteMigration(
				STEPS.IMPORT_LIST.slug,
				'wordpress',
				STEPS.SITE_MIGRATION_IDENTIFY.slug
			)
		).toBe( true );
	} );

	it( 'returns false when current step is not importList', () => {
		expect(
			shouldRedirectToSiteMigration( 'other-step', 'wordpress', 'site-migration-identify' )
		).toBe( false );
	} );

	it( 'returns false when platform is not wordpress', () => {
		expect(
			shouldRedirectToSiteMigration(
				STEPS.IMPORT_LIST.slug,
				'other-platform',
				STEPS.SITE_MIGRATION_IDENTIFY.slug
			)
		).toBe( false );
	} );

	it( 'returns false when the origin is not set', () => {
		expect(
			shouldRedirectToSiteMigration(
				STEPS.IMPORT_LIST.slug,
				STEPS.SITE_MIGRATION_IDENTIFY.slug,
				null
			)
		).toBe( false );
	} );

	it( 'returns false when the origin is not the site-migration-identify', () => {
		expect(
			shouldRedirectToSiteMigration( STEPS.IMPORT_LIST.slug, 'wordpress', 'other-origin' )
		).toBe( false );
	} );
} );