-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
test.ts
126 lines (123 loc) · 6 KB
/
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
import * as ast from "./parser";
import { Xcode } from "./xcode";
import {assert} from "chai";
import * as fs from "fs";
describe("parser", () => {
describe("roundtrips", () => {
[
"tests/simple.pbxproj",
"tests/proj0.pbxproj",
"tests/proj1.pbxproj",
"tests/proj2.pbxproj",
"tests/proj3.pbxproj",
"tests/proj4.pbxproj",
"tests/signing-style/manual.pbxproj",
"tests/signing-style/automatic.pbxproj"
].forEach(f => it(f, () => {
const str = fs.readFileSync(f).toString();
const parsed = ast.parse(str);
const out = parsed.toString();
assert.equal(out, str, "Expect parse and toString to roundtrip");
}));
});
});
describe("dom", () => {
it("can set signing style from automatic to manual", () => {
const xcode = Xcode.open("tests/signing-style/automatic.pbxproj");
xcode.setManualSigningStyle("SampleProvProfApp");
const expected = fs.readFileSync("tests/signing-style/manual.pbxproj").toString();
assert.equal(xcode.toString(), expected);
});
it("can set signing style from manual to automatic", () => {
const xcode = Xcode.open("tests/signing-style/manual.pbxproj");
xcode.setAutomaticSigningStyle("SampleProvProfApp", "W7TGC3P93K");
const expected = fs.readFileSync("tests/signing-style/automatic.pbxproj").toString();
assert.equal(xcode.toString(), expected);
});
it("can upgrade signing style from none to manual", () => {
const xcode = Xcode.open("tests/signing-style/none.pbxproj");
xcode.setManualSigningStyle("SampleProvProfApp");
const expected = fs.readFileSync("tests/signing-style/manual.pbxproj").toString();
assert.equal(xcode.toString(), expected);
});
it("can upgrade signing style from none to manual with specific provisioning profile", () => {
const xcode = Xcode.open("tests/signing-style/none.pbxproj");
xcode.setManualSigningStyle("SampleProvProfApp", {
uuid: "a62743b2-2513-4488-8d83-bad5f3b6716d",
name: "NativeScriptDevProfile",
team: "W7TGC3P93K"
});
const expected = fs.readFileSync("tests/signing-style/manual-with-provisioning.pbxproj").toString();
assert.equal(xcode.toString(), expected);
});
it("can upgrade signing style from automatic to manual with specific provisioning profile", () => {
const xcode = Xcode.open("tests/signing-style/automatic.pbxproj");
xcode.setManualSigningStyle("SampleProvProfApp", {
uuid: "a62743b2-2513-4488-8d83-bad5f3b6716d",
name: "NativeScriptDevProfile",
team: "W7TGC3P93K"
});
const expected = fs.readFileSync("tests/signing-style/manual-with-provisioning.pbxproj").toString();
assert.equal(xcode.toString(), expected);
});
it("can upgrade signing style from automatic to manual with specific provisioning profile and developer code sign identity", () => {
const xcode = Xcode.open("tests/signing-style/automatic.pbxproj");
xcode.setManualSigningStyle("SampleProvProfApp", {
uuid: "a62743b2-2513-4488-8d83-bad5f3b6716d",
name: "NativeScriptDevProfile",
team: "W7TGC3P93K",
identity: "iPhone Developer"
});
const expected = fs.readFileSync("tests/signing-style/manual-with-provisioning-dev.pbxproj").toString();
assert.equal(xcode.toString(), expected);
});
it("can upgrade signing style from automatic to manual with specific provisioning profile and distribution code sign identity", () => {
const xcode = Xcode.open("tests/signing-style/automatic.pbxproj");
xcode.setManualSigningStyle("SampleProvProfApp", {
uuid: "a62743b2-2513-4488-8d83-bad5f3b6716d",
name: "NativeScriptDevProfile",
team: "W7TGC3P93K",
identity: "iPhone Distribution"
});
const expected = fs.readFileSync("tests/signing-style/manual-with-provisioning-dist.pbxproj").toString();
assert.equal(xcode.toString(), expected);
});
it("can upgrade signing style from none to automatic", () => {
const xcode = Xcode.open("tests/signing-style/none.pbxproj");
xcode.setAutomaticSigningStyle("SampleProvProfApp", "W7TGC3P93K");
const expected = fs.readFileSync("tests/signing-style/automatic.pbxproj").toString();
assert.equal(xcode.toString(), expected);
});
it("can upgrade signing style from manual with specific provisioning profile to automatic", () => {
const xcode = Xcode.open("tests/signing-style/manual-with-provisioning.pbxproj");
xcode.setAutomaticSigningStyle("SampleProvProfApp", "W7TGC3P93K");
const expected = fs.readFileSync("tests/signing-style/automatic.pbxproj").toString();
assert.equal(xcode.toString(), expected);
});
it("can read signing style of autmatically signed target", () => {
const xcode = Xcode.open("tests/signing-style/automatic.pbxproj");
const signing = xcode.getSigning("SampleProvProfApp");
assert.deepEqual(signing, { style: "Automatic", team: "W7TGC3P93K" });
});
it("can read signing style of manually signed target", () => {
const xcode = Xcode.open("tests/signing-style/manual-with-provisioning.pbxproj");
const signing = xcode.getSigning("SampleProvProfApp");
assert.deepEqual(signing, {
style: "Manual",
configurations: {
"Debug": {
uuid: 'a62743b2-2513-4488-8d83-bad5f3b6716d',
name: 'NativeScriptDevProfile',
identity: undefined,
team: 'W7TGC3P93K'
},
"Release": {
uuid: 'a62743b2-2513-4488-8d83-bad5f3b6716d',
name: 'NativeScriptDevProfile',
identity: undefined,
team: 'W7TGC3P93K'
}
}
});
});
});