-
Notifications
You must be signed in to change notification settings - Fork 911
/
Copy pathgetBuildPath.test.ts
97 lines (84 loc) · 3.09 KB
/
getBuildPath.test.ts
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import path from 'path';
import fs from 'fs';
import {getTempDirectory} from '../../../../../../jest/helpers';
import {BuildSettings} from '../getBuildSettings';
import {getBuildPath} from '../getBuildPath';
const targetBuildDirName = 'foo';
const targetBuildDirNameWithMaccatalyst = `${targetBuildDirName}-maccatalyst`;
const executableFolderPath = path.join('foo.app', 'Contents', 'MacOS', 'foo');
test('correctly determines macCatalyst build artifact path new style', async () => {
// setup:
const tmpBuildPath = getTempDirectory('maccatalyst-test-dir');
fs.mkdirSync(path.join(tmpBuildPath, targetBuildDirNameWithMaccatalyst), {
recursive: true,
});
// - create buildSettings object that represents this to CLI
const buildSettings: BuildSettings = {
TARGET_BUILD_DIR: path.join(
tmpBuildPath,
targetBuildDirNameWithMaccatalyst,
),
EXECUTABLE_FOLDER_PATH: executableFolderPath,
FULL_PRODUCT_NAME: 'unused-in-this-test',
INFOPLIST_PATH: 'unused-in-this-test',
};
// test:
// - send our buildSettings in and see what build path comes out
const buildPath = await getBuildPath(buildSettings, 'ios', true);
// assert:
expect(buildPath).toBe(
path.join(
tmpBuildPath,
targetBuildDirNameWithMaccatalyst,
executableFolderPath,
),
);
});
test('correctly determines macCatalyst build artifact path old style', async () => {
// setup:
const tmpBuildPath = getTempDirectory('maccatalyst-test-dir');
fs.mkdirSync(path.join(tmpBuildPath, targetBuildDirNameWithMaccatalyst), {
recursive: true,
});
// - create buildSettings object that represents this to CLI
// FIXME get the build settings as side effect from project definition,
// because it's the translation of project settings to path that fails
const buildSettings: BuildSettings = {
TARGET_BUILD_DIR: path.join(tmpBuildPath, targetBuildDirName),
EXECUTABLE_FOLDER_PATH: executableFolderPath,
FULL_PRODUCT_NAME: 'unused-in-this-test',
INFOPLIST_PATH: 'unused-in-this-test',
};
// test:
// - send our buildSettings in and see what build path comes out
const buildPath = await getBuildPath(buildSettings, 'ios', true);
// assert:
expect(buildPath).toBe(
path.join(
tmpBuildPath,
targetBuildDirNameWithMaccatalyst,
executableFolderPath,
),
);
});
test('correctly determines iOS build artifact path', async () => {
// setup:
const tmpBuildPath = getTempDirectory('ios-test-dir');
fs.mkdirSync(path.join(tmpBuildPath, targetBuildDirName), {
recursive: true,
});
// - create buildSettings object that represents this to CLI
const buildSettings: BuildSettings = {
TARGET_BUILD_DIR: path.join(tmpBuildPath, targetBuildDirName),
EXECUTABLE_FOLDER_PATH: executableFolderPath,
FULL_PRODUCT_NAME: 'unused-in-this-test',
INFOPLIST_PATH: 'unused-in-this-test',
};
// test:
// - send our buildSettings in and see what build path comes out
const buildPath = await getBuildPath(buildSettings);
// assert:
expect(buildPath).toBe(
path.join(tmpBuildPath, targetBuildDirName, executableFolderPath),
);
});