|
1 | 1 | import appsFlyer from '../index'; |
2 | 2 | import { RNAppsFlyer } from '../node_modules/react-native/Libraries/BatchedBridge/NativeModules'; |
3 | 3 | import { NativeEventEmitter } from 'react-native'; |
| 4 | +const fs = require('fs'); |
| 5 | +const path = require('path'); |
4 | 6 |
|
5 | 7 | describe("Test appsFlyer API's", () => { |
6 | 8 | afterEach(() => { |
@@ -240,6 +242,26 @@ describe("Test appsFlyer API's", () => { |
240 | 242 | appsFlyer.disableIDFVCollection(true); |
241 | 243 | expect(RNAppsFlyer.disableIDFVCollection).toHaveBeenCalledTimes(1); |
242 | 244 | }); |
| 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 = /final\s+static\s+String\s+PLUGIN_VERSION\s+=\s+"([\d.]+)";/; |
| 258 | + const pluginVersionObjCRegex = /static\s+NSString\s+\*const\s+kAppsFlyerPluginVersion\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 | + }); |
243 | 265 | }); |
244 | 266 |
|
245 | 267 | describe('Test native event emitter', () => { |
@@ -323,3 +345,7 @@ describe('Test native event emitter', () => { |
323 | 345 | nativeEventEmitter.emit('onDeepLinking', nativeEventObject); |
324 | 346 | }); |
325 | 347 | }); |
| 348 | + |
| 349 | +describe('Plugin version alignment between platforms Test', () => { |
| 350 | + |
| 351 | + }); |
0 commit comments