@@ -62,7 +62,7 @@ describe('link', () => {
62
62
} ) ;
63
63
} ) ;
64
64
65
- it ( 'should register native module when android/ios projects are present' , ( ) => {
65
+ it ( 'should register native module when android/ios projects are present' , ( done ) => {
66
66
const registerNativeModule = sinon . stub ( ) ;
67
67
const config = {
68
68
getProjectConfig : ( ) => ( { android : { } , ios : { } , assets : [ ] } ) ,
@@ -83,6 +83,33 @@ describe('link', () => {
83
83
84
84
link ( config , [ 'react-native-blur' ] ) . then ( ( ) => {
85
85
expect ( registerNativeModule . calledTwice ) . to . be . true ;
86
+ done ( ) ;
87
+ } ) ;
88
+ } ) ;
89
+
90
+ it ( 'should run prelink and postlink commands at the appropriate times' , ( done ) => {
91
+ const registerNativeModule = sinon . stub ( ) ;
92
+ const prelink = sinon . stub ( ) . yieldsAsync ( ) ;
93
+ const postlink = sinon . stub ( ) . yieldsAsync ( ) ;
94
+
95
+ mock (
96
+ '../src/ios/registerNativeModule.js' ,
97
+ registerNativeModule
98
+ ) ;
99
+
100
+ const config = {
101
+ getProjectConfig : ( ) => ( { ios : { } , assets : [ ] } ) ,
102
+ getDependencyConfig : sinon . stub ( ) . returns ( {
103
+ ios : { } , assets : [ ] , commands : { prelink, postlink } ,
104
+ } ) ,
105
+ } ;
106
+
107
+ const link = require ( '../src/link' ) ;
108
+
109
+ link ( config , [ 'react-native-blur' ] ) . then ( ( ) => {
110
+ expect ( prelink . calledBefore ( registerNativeModule ) ) . to . be . true ;
111
+ expect ( postlink . calledAfter ( registerNativeModule ) ) . to . be . true ;
112
+ done ( ) ;
86
113
} ) ;
87
114
} ) ;
88
115
0 commit comments