Skip to content

Commit a64676a

Browse files
Sync Android SDK version constant (#925)
1 parent 372f7fc commit a64676a

3 files changed

Lines changed: 53 additions & 1 deletion

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package expo.modules.plaidlinksdk
2+
3+
internal object RNPlaidLinkSdkVersion {
4+
const val SDK_VERSION = "13.0.0"
5+
}

android/src/main/java/expo/modules/plaidlinksdk/ReactNativePlaidLinkSdkModule.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class ReactNativePlaidLinkSdkModule : Module() {
2828
override fun definition() = ModuleDefinition {
2929
Name("ReactNativePlaidLinkSdk")
3030

31-
Constant("sdkVersion") { Plaid.VERSION_NAME }
31+
Constant("sdkVersion") { RNPlaidLinkSdkVersion.SDK_VERSION }
3232

3333
Events("PlaidLink.onSuccess", "PlaidLink.onExit", "PlaidLink.onEvent")
3434

src/__tests__/swift-version-sync.test.ts

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,50 @@ describe("Swift Version Sync", () => {
5353
expect(swiftVersion).toMatch(semverRegex);
5454
});
5555
});
56+
57+
describe("Android Version Sync", () => {
58+
it("RNPlaidLinkSdkVersion.kt should match package.json version", () => {
59+
const kotlinFilePath = path.join(
60+
__dirname,
61+
"../../android/src/main/java/expo/modules/plaidlinksdk/RNPlaidLinkSdkVersion.kt",
62+
);
63+
const kotlinContent = fs.readFileSync(kotlinFilePath, "utf-8");
64+
65+
const versionMatch = kotlinContent.match(/SDK_VERSION\s*=\s*"([^"]+)"/);
66+
67+
expect(versionMatch).not.toBeNull();
68+
69+
if (!versionMatch) {
70+
fail(
71+
"Could not find SDK_VERSION in RNPlaidLinkSdkVersion.kt. " +
72+
'Expected format: const val SDK_VERSION = "X.X.X"',
73+
);
74+
return;
75+
}
76+
77+
const kotlinVersion = versionMatch[1];
78+
const packageVersion = packageJson.version;
79+
80+
expect(kotlinVersion).toBe(packageVersion);
81+
});
82+
83+
it("Android version should be a valid semver string", () => {
84+
const kotlinFilePath = path.join(
85+
__dirname,
86+
"../../android/src/main/java/expo/modules/plaidlinksdk/RNPlaidLinkSdkVersion.kt",
87+
);
88+
const kotlinContent = fs.readFileSync(kotlinFilePath, "utf-8");
89+
90+
const versionMatch = kotlinContent.match(/SDK_VERSION\s*=\s*"([^"]+)"/);
91+
92+
if (!versionMatch) {
93+
fail("Could not find SDK_VERSION in Kotlin file");
94+
return;
95+
}
96+
97+
const kotlinVersion = versionMatch[1];
98+
const semverRegex = /^\d+\.\d+\.\d+/;
99+
100+
expect(kotlinVersion).toMatch(semverRegex);
101+
});
102+
});

0 commit comments

Comments
 (0)