@leonxin/meetgames 0.1.18 → 0.1.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/README.md +16 -6
  2. package/dist/android/detect.d.ts +6 -1
  3. package/dist/android/detect.d.ts.map +1 -1
  4. package/dist/android/detect.js +41 -17
  5. package/dist/android/detect.js.map +1 -1
  6. package/dist/android/gradle.d.ts.map +1 -1
  7. package/dist/android/gradle.js +8 -1
  8. package/dist/android/gradle.js.map +1 -1
  9. package/dist/android/meetSdkRemoteGradle.d.ts +1 -0
  10. package/dist/android/meetSdkRemoteGradle.d.ts.map +1 -1
  11. package/dist/android/meetSdkRemoteGradle.js +44 -21
  12. package/dist/android/meetSdkRemoteGradle.js.map +1 -1
  13. package/dist/cache.d.ts +16 -0
  14. package/dist/cache.d.ts.map +1 -1
  15. package/dist/cache.js +21 -0
  16. package/dist/cache.js.map +1 -1
  17. package/dist/cli.d.ts.map +1 -1
  18. package/dist/cli.js +52 -23
  19. package/dist/cli.js.map +1 -1
  20. package/dist/config/meetSdkDefaultConfig.d.ts +7 -11
  21. package/dist/config/meetSdkDefaultConfig.d.ts.map +1 -1
  22. package/dist/config/meetSdkDefaultConfig.js +216 -53
  23. package/dist/config/meetSdkDefaultConfig.js.map +1 -1
  24. package/dist/config/meetSdkIosConfig.d.ts +4 -5
  25. package/dist/config/meetSdkIosConfig.d.ts.map +1 -1
  26. package/dist/config/meetSdkIosConfig.js +19 -19
  27. package/dist/config/meetSdkIosConfig.js.map +1 -1
  28. package/dist/contracts/types.d.ts +18 -0
  29. package/dist/contracts/types.d.ts.map +1 -1
  30. package/dist/core/doctor.d.ts.map +1 -1
  31. package/dist/core/doctor.js +18 -1
  32. package/dist/core/doctor.js.map +1 -1
  33. package/dist/core/platform.js +1 -1
  34. package/dist/core/platform.js.map +1 -1
  35. package/dist/core/previewPatches.d.ts +2 -2
  36. package/dist/core/previewPatches.d.ts.map +1 -1
  37. package/dist/core/previewPatches.js +3 -3
  38. package/dist/core/previewPatches.js.map +1 -1
  39. package/dist/core/workspace.d.ts.map +1 -1
  40. package/dist/core/workspace.js +3 -1
  41. package/dist/core/workspace.js.map +1 -1
  42. package/dist/index.d.ts +4 -4
  43. package/dist/index.d.ts.map +1 -1
  44. package/dist/index.js +4 -4
  45. package/dist/index.js.map +1 -1
  46. package/dist/mcp/server.d.ts.map +1 -1
  47. package/dist/mcp/server.js +12 -7
  48. package/dist/mcp/server.js.map +1 -1
  49. package/dist/mcp/service.d.ts +6 -0
  50. package/dist/mcp/service.d.ts.map +1 -1
  51. package/dist/mcp/service.js +17 -9
  52. package/dist/mcp/service.js.map +1 -1
  53. package/dist/ops/handlers.d.ts.map +1 -1
  54. package/dist/ops/handlers.js +25 -3
  55. package/dist/ops/handlers.js.map +1 -1
  56. package/dist/remote/sdkHomeDownload.d.ts +4 -5
  57. package/dist/remote/sdkHomeDownload.d.ts.map +1 -1
  58. package/dist/remote/sdkHomeDownload.js +38 -12
  59. package/dist/remote/sdkHomeDownload.js.map +1 -1
  60. package/docs/API.md +13 -13
  61. package/docs/CLI.md +27 -13
  62. package/docs/INTEGRATION.md +7 -6
  63. package/package.json +1 -1
  64. package/src/android/detect.ts +47 -17
  65. package/src/android/gradle.ts +16 -1
  66. package/src/android/meetSdkRemoteGradle.ts +50 -22
  67. package/src/cache.ts +37 -0
  68. package/src/cli.ts +51 -21
  69. package/src/config/meetSdkDefaultConfig.ts +243 -59
  70. package/src/config/meetSdkIosConfig.ts +17 -21
  71. package/src/contracts/types.ts +21 -0
  72. package/src/core/doctor.ts +17 -1
  73. package/src/core/platform.ts +1 -1
  74. package/src/core/previewPatches.ts +3 -3
  75. package/src/core/workspace.ts +3 -1
  76. package/src/index.ts +5 -3
  77. package/src/mcp/server.ts +12 -7
  78. package/src/mcp/service.ts +30 -10
  79. package/src/ops/handlers.ts +27 -3
  80. package/src/remote/sdkHomeDownload.ts +48 -16
  81. package/config/meetsdk-android.json +0 -171
  82. package/config/meetsdk-ios.json +0 -15
  83. package/tests/assemble.test.ts +0 -12
  84. package/tests/doctor.test.ts +0 -131
  85. package/tests/downloadGoogleServicesJson.test.ts +0 -47
  86. package/tests/fetch-remote.test.ts +0 -23
  87. package/tests/fetchConfigOverrides.test.ts +0 -28
  88. package/tests/fetchConfigWrite.test.ts +0 -54
  89. package/tests/fixtures-hosts.test.ts +0 -78
  90. package/tests/gradle.test.ts +0 -33
  91. package/tests/integration-json.test.ts +0 -29
  92. package/tests/ios.codeUtils.test.ts +0 -23
  93. package/tests/ios.sdkBundle.test.ts +0 -21
  94. package/tests/loadManifest.test.ts +0 -15
  95. package/tests/manifest-xml.test.ts +0 -30
  96. package/tests/mcp.e2e.ts +0 -214
  97. package/tests/mcp.service.test.ts +0 -53
  98. package/tests/meetSdkRemoteConfig.test.ts +0 -482
  99. package/tests/meetSdkRemoteGradle.test.ts +0 -414
  100. package/tests/pipeline.android.test.ts +0 -149
  101. package/tests/pipeline.integration-json.test.ts +0 -58
  102. package/tests/pipeline.ios.test.ts +0 -609
  103. package/tests/pipeline.preview.patch.test.ts +0 -85
  104. package/tests/platformSelection.test.ts +0 -77
  105. package/tests/sdkHomeDownload.test.ts +0 -275
  106. package/tests/sdkVersionConfig.test.ts +0 -131
  107. package/tests/topsdk.test.ts +0 -53
  108. package/tests/topsdkDownloadSdkConfig.test.ts +0 -81
  109. package/tests/topsdkFeatureModules.test.ts +0 -116
@@ -1,131 +0,0 @@
1
- import fs from "node:fs";
2
- import os from "node:os";
3
- import path from "node:path";
4
- import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
5
- import { loadManifestFile } from "../src/config/loadManifest.js";
6
- import { runDoctor } from "../src/core/doctor.js";
7
- import { detectSinglePlatform, platformContext } from "../src/core/platform.js";
8
- import { runPipeline } from "../src/core/pipeline.js";
9
- import { buildWorkspaceContext } from "../src/core/workspace.js";
10
- import { resolveIosSdkRootFromDirectory } from "../src/remote/sdkHomeDownload.js";
11
-
12
- const pkgRoot = path.resolve(__dirname, "..");
13
- const androidLatestRoot = path.join(pkgRoot, "fixtures", "android-test-project", "android-latest-project");
14
- const iosProjectRoot = path.join(pkgRoot, "fixtures", "ios-test-project", "native-sample");
15
- const hasIosProjectFixture = fs.existsSync(iosProjectRoot);
16
- const fixtureIosSdkRoot = resolveIosSdkRootFromDirectory(path.join(pkgRoot, "fixtures", "ios-sdk", "topSDK-ios--V1.6.0.5"));
17
-
18
- function copyIosProjectToTemp(): string {
19
- const tmp = fs.mkdtempSync(path.join(os.tmpdir(), "meet-ios-doctor-"));
20
- fs.cpSync(iosProjectRoot, tmp, { recursive: true });
21
- fs.writeFileSync(
22
- path.join(tmp, "meetsdk-remote-config.json"),
23
- JSON.stringify(
24
- {
25
- packageName: "com.meetgames.topsdk.demo",
26
- channel: "APPLE",
27
- devicePlatform: "ios",
28
- topsdk: {
29
- appId: "mock-ios-native-sample-app-id",
30
- appSecret: "mock-ios-native-sample-app-secret-do-not-use-in-production",
31
- },
32
- sdkModules: {
33
- login: {
34
- guest: {},
35
- facebook: {
36
- clientId: "883695101201170",
37
- scheme: "fb883695101201170",
38
- secret: "f840b8663b1351ddcb8f6a640cee18c6",
39
- name: "top-demo",
40
- openMessenger: "0",
41
- },
42
- google: {
43
- clientId: "396842465987-8sg3ngohnl5f2r8no5etu401ruv6snql.apps.googleusercontent.com",
44
- scheme: "com.googleusercontent.apps.396842465987-8sg3ngohnl5f2r8no5etu401ruv6snql",
45
- },
46
- apple: {},
47
- },
48
- payment: { googleIap: {} },
49
- analytics: {
50
- appsflyer: {
51
- devKey: "af-dev-key",
52
- appleAppId: "123456789",
53
- enableDebugLog: true,
54
- },
55
- },
56
- },
57
- },
58
- null,
59
- 2
60
- ),
61
- "utf8"
62
- );
63
- return tmp;
64
- }
65
-
66
- function stubSdkHomeVersion(): void {
67
- vi.stubGlobal(
68
- "fetch",
69
- vi.fn(async () => ({
70
- ok: true,
71
- status: 200,
72
- text: async () =>
73
- JSON.stringify({
74
- code: 200,
75
- data: {
76
- result: {
77
- android: { ver: "1.6.1.3", date: "2026-05-25" },
78
- ios: { ver: "1.6.0.5", date: "2026-06-09" },
79
- },
80
- },
81
- }),
82
- })) as unknown as typeof fetch
83
- );
84
- }
85
-
86
- describe("doctor", () => {
87
- beforeEach(() => {
88
- stubSdkHomeVersion();
89
- });
90
-
91
- afterEach(() => {
92
- vi.unstubAllGlobals();
93
- });
94
-
95
- it("checks Android integration details from project-root config", async () => {
96
- const ctx = buildWorkspaceContext(androidLatestRoot, pkgRoot);
97
- const detected = detectSinglePlatform(ctx);
98
- expect(detected.ok && detected.platform).toBe("android");
99
-
100
- const report = await runDoctor(platformContext(ctx, "android"), "android");
101
-
102
- expect(report.platform).toBe("android");
103
- expect(report.checks.map((c) => c.name)).toContain("android.repositories");
104
- expect(report.checks.map((c) => c.name)).toContain("android.dependencies");
105
- expect(report.checks.map((c) => c.name)).toContain("android.resValues");
106
- });
107
-
108
- it.skipIf(!hasIosProjectFixture)("checks iOS integration details from project-root config", async () => {
109
- const tmp = copyIosProjectToTemp();
110
- try {
111
- const manifest = loadManifestFile(path.join(pkgRoot, "recipes", "ios-default.yaml"));
112
- const applyCtx = buildWorkspaceContext(tmp, pkgRoot, { iosSdkRoot: fixtureIosSdkRoot });
113
- const { report: applyReport } = await runPipeline(applyCtx, manifest, { dryRun: false });
114
- expect(applyReport.errors).toEqual([]);
115
-
116
- const ctx = buildWorkspaceContext(tmp, pkgRoot, { iosSdkRoot: fixtureIosSdkRoot });
117
- const detected = detectSinglePlatform(ctx);
118
- expect(detected.ok && detected.platform).toBe("ios");
119
-
120
- const report = await runDoctor(platformContext(ctx, "ios"), "ios");
121
-
122
- expect(report.platform).toBe("ios");
123
- expect(report.checks.map((c) => c.name)).toContain("ios.frameworkFiles");
124
- expect(report.checks.map((c) => c.name)).toContain("ios.urlSchemes.present");
125
- expect(report.checks.map((c) => c.name)).toContain("ios.appDelegateInjection");
126
- expect(report.errors).toEqual([]);
127
- } finally {
128
- fs.rmSync(tmp, { recursive: true, force: true });
129
- }
130
- });
131
- });
@@ -1,47 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import { resolveGoogleServicesJsonTarget } from "../src/android/downloadGoogleServicesJson.js";
3
-
4
- describe("resolveGoogleServicesJsonTarget", () => {
5
- const root = "/proj";
6
-
7
- it("places file under detected application module with configured name", () => {
8
- const abs = resolveGoogleServicesJsonTarget(
9
- root,
10
- {
11
- firebase_file_url: "https://x/y.json",
12
- firebase_file_name: "google-services.json",
13
- },
14
- "app"
15
- );
16
- expect(abs).toBe("/proj/app/google-services.json");
17
- });
18
-
19
- it("uses non-default module directory", () => {
20
- const abs = resolveGoogleServicesJsonTarget(
21
- root,
22
- { firebase_file_url: "https://x/y.json", firebase_file_name: "google-services.json" },
23
- "launcher"
24
- );
25
- expect(abs).toBe("/proj/launcher/google-services.json");
26
- });
27
-
28
- it("preserves upload file name with extension", () => {
29
- const abs = resolveGoogleServicesJsonTarget(
30
- root,
31
- {
32
- firebase_file_url: "https://x/y.json",
33
- firebase_file_name: "google-services.json",
34
- },
35
- "app"
36
- );
37
- expect(abs.endsWith("google-services.json")).toBe(true);
38
- });
39
-
40
- it("falls back to project root when application module unknown", () => {
41
- const abs = resolveGoogleServicesJsonTarget(root, {
42
- firebase_file_url: "https://x/y.json",
43
- firebase_file_name: "google-services.json",
44
- });
45
- expect(abs).toBe("/proj/google-services.json");
46
- });
47
- });
@@ -1,23 +0,0 @@
1
- import { afterEach, describe, expect, it, vi } from "vitest";
2
- import { fetchJsonGet } from "../src/remote/fetchJson.js";
3
-
4
- describe("fetchJsonGet", () => {
5
- afterEach(() => {
6
- vi.unstubAllGlobals();
7
- });
8
-
9
- it("parses JSON bodies", async () => {
10
- vi.stubGlobal(
11
- "fetch",
12
- vi.fn(async () => ({
13
- ok: true,
14
- status: 200,
15
- headers: { get: () => "application/json" },
16
- text: async () => JSON.stringify({ hello: "world" }),
17
- })) as unknown as typeof fetch
18
- );
19
-
20
- const body = await fetchJsonGet("https://example.com/cfg.json");
21
- expect(body).toEqual({ hello: "world" });
22
- });
23
- });
@@ -1,28 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import { applyFetchConfigCliOverrides, defaultSdkModules } from "../src/config/meetSdkRemoteConfig.js";
3
-
4
- describe("applyFetchConfigCliOverrides", () => {
5
- const base = {
6
- packageName: "com.from.server",
7
- channel: "google",
8
- topsdk: {
9
- appId: "111",
10
- appSecret: "server-secret",
11
- version: "",
12
- groupId: "",
13
- repositories: [],
14
- },
15
- sdkModules: defaultSdkModules(),
16
- };
17
-
18
- it("overrides topsdk appId and root channel only", () => {
19
- const out = applyFetchConfigCliOverrides(base, {
20
- appId: "222",
21
- channelType: "google",
22
- });
23
- expect(out.topsdk.appId).toBe("222");
24
- expect(out.channel).toBe("GOOGLE");
25
- expect(out.topsdk.appSecret).toBe("server-secret");
26
- expect(out.packageName).toBe("com.from.server");
27
- });
28
- });
@@ -1,54 +0,0 @@
1
- import fs from "node:fs";
2
- import os from "node:os";
3
- import path from "node:path";
4
- import { afterEach, describe, expect, it } from "vitest";
5
- import {
6
- validateDownloadSdkConfigForWrite,
7
- writeDownloadSdkConfigRaw,
8
- } from "../src/config/fetchConfigWrite.js";
9
-
10
- describe("fetchConfigWrite", () => {
11
- const tmpDirs: string[] = [];
12
-
13
- afterEach(() => {
14
- for (const dir of tmpDirs) {
15
- fs.rmSync(dir, { recursive: true, force: true });
16
- }
17
- tmpDirs.length = 0;
18
- });
19
-
20
- it("writeDownloadSdkConfigRaw preserves response bytes (no JSON re-serialize)", () => {
21
- const dir = fs.mkdtempSync(path.join(os.tmpdir(), "meet-fetch-"));
22
- tmpDirs.push(dir);
23
- const out = path.join(dir, "meetsdk-remote-config.json");
24
- const raw = `{
25
- "packageName": "com.example.game",
26
- "channel": "GOOGLE",
27
- "devicePlatform": "android",
28
- "topsdk": { "appId": "1", "appSecret": "sec" },
29
- "sdkModules": { "login": {}, "payment": {}, "analytics": {} }
30
- }`;
31
-
32
- writeDownloadSdkConfigRaw(out, raw);
33
- expect(fs.readFileSync(out, "utf8")).toBe(raw);
34
- });
35
-
36
- it("validateDownloadSdkConfigForWrite accepts valid remote config without meetsdk-android fields", () => {
37
- const body = {
38
- packageName: "com.example.game",
39
- channel: "GOOGLE",
40
- devicePlatform: "android",
41
- topsdk: { appId: "1", appSecret: "sec" },
42
- sdkModules: { login: {}, payment: {}, analytics: {} },
43
- };
44
- const result = validateDownloadSdkConfigForWrite(body);
45
- expect(result?.parsed.packageName).toBe("com.example.game");
46
- expect(result?.parsed.topsdk.version).toBe("");
47
- expect((result?.parsed as { dependencies?: unknown }).dependencies).toBeUndefined();
48
- });
49
-
50
- it("validateDownloadSdkConfigForWrite rejects invalid documents", () => {
51
- expect(validateDownloadSdkConfigForWrite(null)).toBeNull();
52
- expect(validateDownloadSdkConfigForWrite({ topsdk: {} })).toBeNull();
53
- });
54
- });
@@ -1,78 +0,0 @@
1
- import fs from "node:fs";
2
- import os from "node:os";
3
- import path from "node:path";
4
- import { fileURLToPath } from "node:url";
5
- import { describe, expect, it } from "vitest";
6
- import { buildWorkspaceContext } from "../src/core/workspace.js";
7
-
8
- const here = path.dirname(fileURLToPath(import.meta.url));
9
- const pkgRoot = path.resolve(here, "..");
10
- const androidFixtureRoot = path.join(pkgRoot, "fixtures", "android-test-project");
11
-
12
- function fixtureProjectRoot(...names: string[]): string {
13
- for (const name of names) {
14
- const candidate = path.join(androidFixtureRoot, name);
15
- if (fs.existsSync(candidate)) return candidate;
16
- }
17
- return path.join(androidFixtureRoot, names[0] ?? "");
18
- }
19
-
20
- function createAndroidAppModule(root: string, name: string, applicationId: string): void {
21
- const moduleDir = path.join(root, name);
22
- fs.mkdirSync(path.join(moduleDir, "src", "main"), { recursive: true });
23
- fs.writeFileSync(
24
- path.join(moduleDir, "build.gradle"),
25
- [
26
- "plugins {",
27
- " id 'com.android.application'",
28
- "}",
29
- "android {",
30
- " defaultConfig {",
31
- ` applicationId '${applicationId}'`,
32
- " }",
33
- "}",
34
- "",
35
- ].join("\n"),
36
- "utf8"
37
- );
38
- fs.writeFileSync(path.join(moduleDir, "src", "main", "AndroidManifest.xml"), "<manifest />\n", "utf8");
39
- }
40
-
41
- describe("fixture host trees", () => {
42
- const powerRaidRoot = fixtureProjectRoot("power-raid");
43
-
44
- it("android-latest-project (plugins DSL) resolves application module :app", () => {
45
- const root = path.join(androidFixtureRoot, "android-latest-project");
46
- const ctx = buildWorkspaceContext(root, pkgRoot);
47
- expect(ctx.android?.ok).toBe(true);
48
- expect(ctx.android?.ok && ctx.android.moduleName).toBe(":app");
49
- expect(ctx.android?.ok && ctx.android.moduleDir.endsWith(`${path.sep}app`)).toBe(true);
50
- });
51
-
52
- it.skipIf(!fs.existsSync(powerRaidRoot))("power-raid resolves launcher application module", () => {
53
- const ctx = buildWorkspaceContext(powerRaidRoot, pkgRoot);
54
- expect(ctx.android?.ok).toBe(true);
55
- expect(ctx.android?.ok && ctx.android.moduleName).toBe(":launcher");
56
- expect(ctx.android?.ok && ctx.android.moduleDir.endsWith(`${path.sep}launcher`)).toBe(true);
57
- });
58
-
59
- it("requires an Android app module selector when multiple application modules exist", () => {
60
- const root = fs.mkdtempSync(path.join(os.tmpdir(), "meet-android-multi-app-"));
61
- fs.writeFileSync(path.join(root, "settings.gradle"), "include ':app'\ninclude ':demo'\n", "utf8");
62
- createAndroidAppModule(root, "app", "com.example.app");
63
- createAndroidAppModule(root, "demo", "com.example.demo");
64
-
65
- const ambiguous = buildWorkspaceContext(root, pkgRoot);
66
- expect(ambiguous.android?.ok).toBe(false);
67
- expect(ambiguous.android?.ok ? "" : ambiguous.android?.error).toContain("MULTIPLE_APPLICATION_MODULES_FOUND: :app, :demo");
68
-
69
- const selected = buildWorkspaceContext(root, pkgRoot, { appTarget: "demo" });
70
- expect(selected.android?.ok).toBe(true);
71
- expect(selected.android?.ok && selected.android.moduleName).toBe(":demo");
72
- expect(selected.android?.ok && selected.android.moduleDir.endsWith(`${path.sep}demo`)).toBe(true);
73
-
74
- const missing = buildWorkspaceContext(root, pkgRoot, { appTarget: "missing" });
75
- expect(missing.android?.ok).toBe(false);
76
- expect(missing.android?.ok ? "" : missing.android?.error).toContain("ANDROID_APPLICATION_MODULE_NOT_FOUND: :missing");
77
- });
78
- });
@@ -1,33 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import { updateModuleBuildGradleDependencies, updateRootBuildGradleRepositories } from "../src/android/gradle.js";
3
-
4
- describe("gradle editors", () => {
5
- it("inserts managed repositories", () => {
6
- const root = `
7
- allprojects {
8
- repositories {
9
- google()
10
- }
11
- }
12
- `;
13
- const res = updateRootBuildGradleRepositories(root, ["https://m.example.com"]);
14
- expect(res.ok).toBe(true);
15
- if (!res.ok) return;
16
- expect(res.content).toContain("MEET_INTEGRATE REPOS");
17
- expect(res.content).toContain("m.example.com");
18
- });
19
-
20
- it("inserts managed dependencies", () => {
21
- const mod = `
22
- apply plugin: 'com.android.application'
23
- android { defaultConfig { } }
24
- dependencies {
25
- }
26
- `;
27
- const res = updateModuleBuildGradleDependencies(mod, [` implementation 'com.demo:lib:1.0'`]);
28
- expect(res.ok).toBe(true);
29
- if (!res.ok) return;
30
- expect(res.content).toContain("MEET_INTEGRATE BLOCK");
31
- expect(res.content).toContain("com.demo:lib");
32
- });
33
- });
@@ -1,29 +0,0 @@
1
- import fs from "node:fs";
2
- import os from "node:os";
3
- import path from "node:path";
4
- import { describe, expect, it } from "vitest";
5
- import { loadAndroidIntegrationFile } from "../src/config/loadAndroidIntegration.js";
6
-
7
- describe("android integration json", () => {
8
- it("loads and validates integration file", () => {
9
- const dir = fs.mkdtempSync(path.join(os.tmpdir(), "meet-int-json-"));
10
- const p = path.join(dir, "cfg.json");
11
- fs.writeFileSync(
12
- p,
13
- JSON.stringify(
14
- {
15
- version: 1,
16
- meta: { sourceUrl: "https://example.com/cfg", fetchedAt: "2026-01-01T00:00:00.000Z" },
17
- steps: [{ op: "gradle.insertRepositories", platform: "android", args: { urls: ["mavenCentral"] } }],
18
- },
19
- null,
20
- 2
21
- ),
22
- "utf8"
23
- );
24
- const doc = loadAndroidIntegrationFile(p);
25
- expect(doc.version).toBe(1);
26
- expect(doc.steps.length).toBe(1);
27
- fs.rmSync(dir, { recursive: true, force: true });
28
- });
29
- });
@@ -1,23 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import { CodeUtils } from "../src/ios/codeUtils.js";
3
-
4
- describe("CodeUtils", () => {
5
- it("adds header and method body without duplicating", () => {
6
- const initial = `@implementation AppDelegate
7
- - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
8
- return YES;
9
- }
10
- @end
11
- `;
12
- const cu = new CodeUtils("AppDelegate.m", initial);
13
- cu.addHeader('#import <TOPSDK/TopSDK.h>');
14
- cu.addCodeToMethod(
15
- "- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions",
16
- "[TopSDK.sharedInstance application:application didFinishLaunchingWithOptions:launchOptions]"
17
- );
18
- cu.addHeader('#import <TOPSDK/TopSDK.h>');
19
- expect(cu.text).toContain("#import <TOPSDK/TopSDK.h>");
20
- expect(cu.text).toContain("TopSDK.sharedInstance");
21
- expect(cu.text.split("#import <TOPSDK/TopSDK.h>").length - 1).toBe(1);
22
- });
23
- });
@@ -1,21 +0,0 @@
1
- import fs from "node:fs";
2
- import path from "node:path";
3
- import { fileURLToPath } from "node:url";
4
- import { describe, expect, it } from "vitest";
5
- import { resolveIosSdkRoot } from "../src/ios/sdkBundle.js";
6
- import { MEET_SDK_TOOL_CACHE_ROOT } from "../src/cache.js";
7
-
8
- const pkgRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
9
-
10
- describe("resolveIosSdkRoot", () => {
11
- it("uses only the iOS SDK cache", () => {
12
- try {
13
- const root = resolveIosSdkRoot(pkgRoot);
14
- expect(root).toContain(`${path.sep}.cache${path.sep}meet-sdk-tool${path.sep}sdk${path.sep}ios`);
15
- expect(fs.existsSync(path.join(root, "sdk", "topsdkConfig.t.json"))).toBe(true);
16
- expect(fs.existsSync(path.join(root, "plugins"))).toBe(true);
17
- } catch (e) {
18
- expect(e instanceof Error ? e.message : String(e)).toContain(path.join(MEET_SDK_TOOL_CACHE_ROOT, "sdk", "ios"));
19
- }
20
- });
21
- });
@@ -1,15 +0,0 @@
1
- import fs from "node:fs";
2
- import os from "node:os";
3
- import path from "node:path";
4
- import { describe, expect, it } from "vitest";
5
- import { loadManifestFile } from "../src/config/loadManifest.js";
6
-
7
- describe("loadManifest", () => {
8
- it("rejects invalid manifests", () => {
9
- const dir = fs.mkdtempSync(path.join(os.tmpdir(), "meet-int-"));
10
- const p = path.join(dir, "bad.yaml");
11
- fs.writeFileSync(p, "version: 1\n", "utf8");
12
- expect(() => loadManifestFile(p)).toThrow(/Manifest validation failed/);
13
- fs.rmSync(dir, { recursive: true, force: true });
14
- });
15
- });
@@ -1,30 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import { extractPermissionName, insertPermissions } from "../src/android/manifest.js";
3
-
4
- describe("android manifest", () => {
5
- it("inserts permissions block before closing manifest", () => {
6
- const xml = `<?xml version="1.0" encoding="utf-8"?>
7
- <manifest package="a.b">
8
- <application />
9
- </manifest>`;
10
- const { content, changed } = insertPermissions(xml, ["android.permission.INTERNET"]);
11
- expect(changed).toBe(true);
12
- expect(content).toContain("uses-permission");
13
- expect(content).toContain("INTERNET");
14
- });
15
-
16
- it("updates permission by android:name instead of duplicating", () => {
17
- const xml = `<?xml version="1.0" encoding="utf-8"?>
18
- <manifest package="a.b">
19
- <uses-permission android:name="android.permission.INTERNET" />
20
- <!-- MEET_INTEGRATE PERMISSIONS START -->
21
- <uses-permission android:name="android.permission.INTERNET" />
22
- <!-- MEET_INTEGRATE PERMISSIONS END -->
23
- <application />
24
- </manifest>`;
25
- const { content } = insertPermissions(xml, ["android.permission.INTERNET"]);
26
- const permLines = content.split("\n").filter((l) => extractPermissionName(l));
27
- expect(permLines.length).toBe(1);
28
- expect(content).toContain('android:name="android.permission.INTERNET"');
29
- });
30
- });