Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package expo.modules.plaidlinksdk

internal object RNPlaidLinkSdkVersion {
const val SDK_VERSION = "13.0.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ReactNativePlaidLinkSdkModule : Module() {
override fun definition() = ModuleDefinition {
Name("ReactNativePlaidLinkSdk")

Constant("sdkVersion") { Plaid.VERSION_NAME }
Constant("sdkVersion") { RNPlaidLinkSdkVersion.SDK_VERSION }

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

Expand Down
47 changes: 47 additions & 0 deletions src/__tests__/swift-version-sync.test.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import fs from "fs";
import path from "path";

Check warning on line 2 in src/__tests__/swift-version-sync.test.ts

View workflow job for this annotation

GitHub Actions / install-and-test

There should be at least one empty line between import groups
import packageJson from "../../package.json";

describe("Swift Version Sync", () => {
it("RNPlaidLinkSdkVersion.swift should match package.json version", () => {
const swiftFilePath = path.join(
__dirname,
"../../ios/src/RNPlaidLinkSdkVersion.swift"

Check warning on line 9 in src/__tests__/swift-version-sync.test.ts

View workflow job for this annotation

GitHub Actions / install-and-test

Insert `,`
);
const swiftContent = fs.readFileSync(swiftFilePath, "utf-8");

// Extract version from: @objc public static let sdkVersion: String = "X.X.X"
const versionMatch = swiftContent.match(
/sdkVersion:\s*String\s*=\s*"([^"]+)"/

Check warning on line 15 in src/__tests__/swift-version-sync.test.ts

View workflow job for this annotation

GitHub Actions / install-and-test

Insert `,`
);

expect(versionMatch).not.toBeNull();
Expand All @@ -20,7 +20,7 @@
if (!versionMatch) {
fail(
"Could not find sdkVersion in RNPlaidLinkSdkVersion.swift. " +
'Expected format: @objc public static let sdkVersion: String = "X.X.X"'

Check warning on line 23 in src/__tests__/swift-version-sync.test.ts

View workflow job for this annotation

GitHub Actions / install-and-test

Insert `,`
);
return;
}
Expand Down Expand Up @@ -53,3 +53,50 @@
expect(swiftVersion).toMatch(semverRegex);
});
});

describe("Android Version Sync", () => {
it("RNPlaidLinkSdkVersion.kt should match package.json version", () => {
const kotlinFilePath = path.join(
__dirname,
"../../android/src/main/java/expo/modules/plaidlinksdk/RNPlaidLinkSdkVersion.kt",
);
const kotlinContent = fs.readFileSync(kotlinFilePath, "utf-8");

const versionMatch = kotlinContent.match(/SDK_VERSION\s*=\s*"([^"]+)"/);

expect(versionMatch).not.toBeNull();

if (!versionMatch) {
fail(
"Could not find SDK_VERSION in RNPlaidLinkSdkVersion.kt. " +
'Expected format: const val SDK_VERSION = "X.X.X"',
);
return;
}

const kotlinVersion = versionMatch[1];
const packageVersion = packageJson.version;

expect(kotlinVersion).toBe(packageVersion);
});

it("Android version should be a valid semver string", () => {
const kotlinFilePath = path.join(
__dirname,
"../../android/src/main/java/expo/modules/plaidlinksdk/RNPlaidLinkSdkVersion.kt",
);
const kotlinContent = fs.readFileSync(kotlinFilePath, "utf-8");

const versionMatch = kotlinContent.match(/SDK_VERSION\s*=\s*"([^"]+)"/);

if (!versionMatch) {
fail("Could not find SDK_VERSION in Kotlin file");
return;
}

const kotlinVersion = versionMatch[1];
const semverRegex = /^\d+\.\d+\.\d+/;

expect(kotlinVersion).toMatch(semverRegex);
});
});
Loading