@@ -6,6 +6,7 @@ const mock = jest.spyOn(require('../../../utils/stringSplice'), 'stringSplice');
6
6
import { appDelegateTask , runTask } from '../../../tasks/appDelegateTask' ;
7
7
import { AppDelegateTaskType } from '../../../types/mod.types' ;
8
8
import { writeMockAppDelegate } from '../../mocks/mockAll' ;
9
+ import { mockAppDelegateSwiftTemplate } from '../../mocks/mockAppDelegateSwiftTemplate' ;
9
10
import { mockAppDelegateTemplate } from '../../mocks/mockAppDelegateTemplate' ;
10
11
11
12
describe ( 'appDelegateTask' , ( ) => {
@@ -37,6 +38,31 @@ describe('appDelegateTask', () => {
37
38
expect . stringContaining ( 'found existing ' )
38
39
) ;
39
40
} ) ;
41
+ it ( 'should prepend text into didLaunchWithOptions in swift lang' , async ( ) => {
42
+ let content = mockAppDelegateSwiftTemplate ;
43
+ const task : AppDelegateTaskType = {
44
+ task : 'app_delegate' ,
45
+ lang : 'swift' ,
46
+ actions : [
47
+ {
48
+ prepend : 'import Firebase' ,
49
+ } ,
50
+ {
51
+ block : 'didFinishLaunchingWithOptions' ,
52
+ prepend : 'FirebaseApp.configure()' ,
53
+ } ,
54
+ ] ,
55
+ } ;
56
+ content = await appDelegateTask ( {
57
+ configPath : 'path/to/config' ,
58
+ task : task ,
59
+ content,
60
+ packageName : 'test-package' ,
61
+ } ) ;
62
+ console . log ( 'content' , content ) ;
63
+ // @ts -ignore
64
+ expect ( content ) . toContain ( task . actions [ 1 ] . prepend ) ;
65
+ } ) ;
40
66
it ( 'should prepend text into didLaunchWithOptions' , async ( ) => {
41
67
let content = mockAppDelegateTemplate ;
42
68
const task : AppDelegateTaskType = {
0 commit comments