-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathadd.ios.spec.ts
More file actions
41 lines (34 loc) · 1.35 KB
/
add.ios.spec.ts
File metadata and controls
41 lines (34 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { APP_ID, APP_NAME, run, makeAppDir, MappedFS, installPlatform } from './util';
describe.each([false, true])('Add: iOS (monoRepoLike: %p)', (monoRepoLike) => {
let appDirObj: any;
let FS: MappedFS;
beforeAll(async () => {
// These commands are slowww...
jest.setTimeout(150000);
appDirObj = await makeAppDir(monoRepoLike);
const appDir = appDirObj.appDir;
// Init in this directory so we can test add
await run(appDir, `init "${APP_NAME}" "${APP_ID}"`);
await installPlatform(appDir, 'ios');
await run(appDir, `add ios`);
FS = new MappedFS(appDir);
});
after all(() => {
appDirObj.cleanupCallback();
});
it('Should add', async () => {
expect(await FS.exists('ios/')).toBe(true);
});
it('Should update Info.plist', async () => {
const infoContent = await FS.read('ios/App/App/Info.plist');
const regex = new RegExp(`<key>CFBundleDisplayName</key>[^<]*<string>${APP_NAME}</string>`);
expect(regex.test(infoContent)).toBe(true);
});
it('Should update project.pbxproj', async () => {
const pbxContent = await FS.read('ios/App/App.xcodeproj/project.pbxproj');
const regex = new RegExp(`PRODUCT_BUNDLE_IDENTIFIER = ${APP_ID}`);
expect(regex.test(pbxContent)).toBe(true);
});
// Other test ideas:
// should install/copy pre-existing cordova/capacitor plugins in package.json
});