@@ -19,21 +19,12 @@ afterEach(() => {
19
19
describe ( 'getSubmitMethod' , ( ) => {
20
20
test ( 'should use xhr for final harvest when isBrowserScope is false' , ( ) => {
21
21
jest . replaceProperty ( runtimeModule , 'isBrowserScope' , false )
22
- jest . replaceProperty ( runtimeModule , 'supportsSendBeacon' , true )
23
22
24
23
expect ( submitData . getSubmitMethod ( { isFinalHarvest : true } ) ) . toEqual ( submitData . xhr )
25
24
} )
26
25
27
- test ( 'should use xhr for final harvest when supportsSendBeacon is false ' , ( ) => {
26
+ test ( 'should use beacon for final harvest when isBrowserScope is true ' , ( ) => {
28
27
jest . replaceProperty ( runtimeModule , 'isBrowserScope' , true )
29
- jest . replaceProperty ( runtimeModule , 'supportsSendBeacon' , false )
30
-
31
- expect ( submitData . getSubmitMethod ( { isFinalHarvest : true } ) ) . toEqual ( submitData . xhr )
32
- } )
33
-
34
- test ( 'should use beacon for final harvest when isBrowserScope and supportsSendBeacon is true' , ( ) => {
35
- jest . replaceProperty ( runtimeModule , 'isBrowserScope' , true )
36
- jest . replaceProperty ( runtimeModule , 'supportsSendBeacon' , true )
37
28
38
29
expect ( submitData . getSubmitMethod ( { isFinalHarvest : true } ) ) . toEqual ( submitData . beacon )
39
30
} )
@@ -42,14 +33,12 @@ describe('getSubmitMethod', () => {
42
33
null , undefined , false
43
34
] ) ( 'should use xhr when final harvest is %s' , ( isFinalHarvest ) => {
44
35
jest . replaceProperty ( runtimeModule , 'isBrowserScope' , true )
45
- jest . replaceProperty ( runtimeModule , 'supportsSendBeacon' , true )
46
36
47
37
expect ( submitData . getSubmitMethod ( { isFinalHarvest } ) ) . toEqual ( submitData . xhr )
48
38
} )
49
39
50
40
test ( 'should use xhr when opts is undefined' , ( ) => {
51
41
jest . replaceProperty ( runtimeModule , 'isBrowserScope' , true )
52
- jest . replaceProperty ( runtimeModule , 'supportsSendBeacon' , true )
53
42
54
43
expect ( submitData . getSubmitMethod ( ) ) . toEqual ( submitData . xhr )
55
44
} )
0 commit comments