Skip to content

Commit e1269de

Browse files
committed
test: update tests
1 parent 71b3112 commit e1269de

File tree

2 files changed

+51
-33
lines changed

2 files changed

+51
-33
lines changed

test/cocoapods-service.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ function createTestInjector(): IInjector {
3838
testInjector.register("logger", LoggerStub);
3939
testInjector.register("config", {});
4040
testInjector.register("xcconfigService", XcconfigService);
41+
testInjector.register("xcodeSelectService", {
42+
getXcodeVersion() {
43+
return {
44+
major: 14,
45+
};
46+
},
47+
});
4148
testInjector.register("projectData", {});
4249
testInjector.register("cocoaPodsPlatformManager", CocoaPodsPlatformManager);
4350

test/ios-project-service.ts

Lines changed: 44 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,13 @@ function createTestInjector(
110110
);
111111
testInjector.register("projectData", projectData);
112112
testInjector.register("projectHelper", {});
113-
testInjector.register("xcodeSelectService", {});
113+
testInjector.register("xcodeSelectService", {
114+
getXcodeVersion() {
115+
return {
116+
major: 14,
117+
};
118+
},
119+
});
114120
testInjector.register("staticConfig", ConfigLib.StaticConfig);
115121
testInjector.register("projectDataService", ProjectDataServiceStub);
116122
testInjector.register("prompter", {});
@@ -259,24 +265,24 @@ describe("Cocoapods support", () => {
259265
if (require("os").platform() !== "darwin") {
260266
console.log("Skipping Cocoapods tests. They cannot work on windows");
261267
} else {
262-
const expectedArchExclusions = (projectPath: string) =>
263-
[
264-
``,
265-
`post_install do |installer|`,
266-
` post_installNativeScript_CLI_Architecture_Exclusions_0 installer`,
267-
`end`,
268-
``,
269-
`# Begin Podfile - ${projectPath}/platforms/ios/Podfile-exclusions`,
270-
`def post_installNativeScript_CLI_Architecture_Exclusions_0 (installer)`,
271-
` installer.pods_project.build_configurations.each do |config|`,
272-
` config.build_settings.delete "VALID_ARCHS"`,
273-
` config.build_settings["EXCLUDED_ARCHS_x86_64"] = "arm64 arm64e"`,
274-
` config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "i386 armv6 armv7 armv7s armv8 $(EXCLUDED_ARCHS_$(NATIVE_ARCH_64_BIT))"`,
275-
` config.build_settings["EXCLUDED_ARCHS[sdk=iphoneos*]"] = "i386 armv6 armv7 armv7s armv8 x86_64"`,
276-
` end`,
277-
`end`,
278-
`# End Podfile`,
279-
].join("\n");
268+
// const expectedArchExclusions = (projectPath: string) =>
269+
// [
270+
// ``,
271+
// `post_install do |installer|`,
272+
// ` post_installNativeScript_CLI_Architecture_Exclusions_0 installer`,
273+
// `end`,
274+
// ``,
275+
// `# Begin Podfile - ${projectPath}/platforms/ios/Podfile-exclusions`,
276+
// `def post_installNativeScript_CLI_Architecture_Exclusions_0 (installer)`,
277+
// ` installer.pods_project.build_configurations.each do |config|`,
278+
// ` config.build_settings.delete "VALID_ARCHS"`,
279+
// ` config.build_settings["EXCLUDED_ARCHS_x86_64"] = "arm64 arm64e"`,
280+
// ` config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "i386 armv6 armv7 armv7s armv8 $(EXCLUDED_ARCHS_$(NATIVE_ARCH_64_BIT))"`,
281+
// ` config.build_settings["EXCLUDED_ARCHS[sdk=iphoneos*]"] = "i386 armv6 armv7 armv7s armv8 x86_64"`,
282+
// ` end`,
283+
// `end`,
284+
// `# End Podfile`,
285+
// ].join("\n");
280286

281287
it("adds а base Podfile", async () => {
282288
const projectName = "projectDirectory";
@@ -486,7 +492,8 @@ describe("Cocoapods support", () => {
486492
`# Begin Podfile - ${pluginPodfilePath}`,
487493
expectedPluginPodfileContent,
488494
"# End Podfile",
489-
expectedArchExclusions(projectPath),
495+
// only on xcode 12
496+
// expectedArchExclusions(projectPath),
490497
"end",
491498
].join("\n");
492499
assert.equal(actualProjectPodfileContent, expectedProjectPodfileContent);
@@ -613,7 +620,8 @@ describe("Cocoapods support", () => {
613620
`# Begin Podfile - ${pluginPodfilePath}`,
614621
expectedPluginPodfileContent,
615622
"# End Podfile",
616-
expectedArchExclusions(projectPath),
623+
// only on XCode 12
624+
// expectedArchExclusions(projectPath),
617625
"end",
618626
].join("\n");
619627
assert.equal(actualProjectPodfileContent, expectedProjectPodfileContent);
@@ -623,18 +631,21 @@ describe("Cocoapods support", () => {
623631
projectData
624632
);
625633

626-
const expectedProjectPodfileContentAfter = [
627-
"use_frameworks!\n",
628-
`target "${projectName}" do`,
629-
"",
630-
expectedArchExclusions(projectPath),
631-
"end",
632-
].join("\n");
633-
actualProjectPodfileContent = fs.readText(projectPodfilePath);
634-
assert.equal(
635-
actualProjectPodfileContent,
636-
expectedProjectPodfileContentAfter
637-
);
634+
assert.isFalse(fs.exists(projectPodfilePath));
635+
636+
// only on xcode12
637+
// const expectedProjectPodfileContentAfter = [
638+
// "use_frameworks!\n",
639+
// `target "${projectName}" do`,
640+
// "",
641+
// expectedArchExclusions(projectPath),
642+
// "end",
643+
// ].join("\n");
644+
// actualProjectPodfileContent = fs.readText(projectPodfilePath);
645+
// assert.equal(
646+
// actualProjectPodfileContent,
647+
// expectedProjectPodfileContentAfter
648+
// );
638649
});
639650
}
640651
});

0 commit comments

Comments
 (0)