11import appsFlyer from '../index' ;
22import { RNAppsFlyer } from '../node_modules/react-native/Libraries/BatchedBridge/NativeModules' ;
33import { NativeEventEmitter } from 'react-native' ;
4+ const fs = require ( 'fs' ) ;
5+ const path = require ( 'path' ) ;
46
57describe ( "Test appsFlyer API's" , ( ) => {
68 afterEach ( ( ) => {
@@ -240,6 +242,26 @@ describe("Test appsFlyer API's", () => {
240242 appsFlyer . disableIDFVCollection ( true ) ;
241243 expect ( RNAppsFlyer . disableIDFVCollection ) . toHaveBeenCalledTimes ( 1 ) ;
242244 } ) ;
245+
246+ test ( 'plugin version between platforms should match' , ( ) => {
247+ const RNJavaFile = fs . readFileSync (
248+ path . resolve ( __dirname , '../android/src/main/java/com/appsflyer/reactnative/RNAppsFlyerConstants.java' ) ,
249+ 'utf-8'
250+ ) ;
251+
252+ const RNObjCFile = fs . readFileSync (
253+ path . resolve ( __dirname , '../ios/RNAppsFlyer.h' ) ,
254+ 'utf-8'
255+ ) ;
256+
257+ const pluginVersionJavaRegex = / f i n a l \s + s t a t i c \s + S t r i n g \s + P L U G I N _ V E R S I O N \s + = \s + " ( [ \d . ] + ) " ; / ;
258+ const pluginVersionObjCRegex = / s t a t i c \s + N S S t r i n g \s + \* c o n s t \s + k A p p s F l y e r P l u g i n V e r s i o n \s + = \s + @ " ( [ \d . ] + ) " ; / ;
259+
260+ const versionAndroid = RNJavaFile . match ( pluginVersionJavaRegex ) [ 1 ] ;
261+ const versionIos = RNObjCFile . match ( pluginVersionObjCRegex ) [ 1 ] ;
262+
263+ expect ( versionAndroid ) . toEqual ( versionIos ) ;
264+ } ) ;
243265} ) ;
244266
245267describe ( 'Test native event emitter' , ( ) => {
@@ -322,4 +344,4 @@ describe('Test native event emitter', () => {
322344
323345 nativeEventEmitter . emit ( 'onDeepLinking' , nativeEventObject ) ;
324346 } ) ;
325- } ) ;
347+ } ) ;
0 commit comments