forked from alunny/node-xcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaddToPbxFileReferenceSection.js
More file actions
62 lines (51 loc) · 3.19 KB
/
addToPbxFileReferenceSection.js
File metadata and controls
62 lines (51 loc) · 3.19 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
var jsonProject = require('./fixtures/full-project')
fullProjectStr = JSON.stringify(jsonProject),
pbx = require('../lib/pbxProject'),
pbxFile = require('../lib/pbxFile'),
myProj = new pbx('.');
function cleanHash() {
return JSON.parse(fullProjectStr);
}
exports.setUp = function (callback) {
myProj.hash = cleanHash();
callback();
}
exports['addToPbxFileReferenceSection function'] = {
'should add file and comment to fileReferenceSection': function (test) {
var file = new pbxFile('file.m');
file.fileRef = myProj.generateUuid();
myProj.addToPbxFileReferenceSection(file)
test.equal(myProj.pbxFileReferenceSection()[file.fileRef].isa, 'PBXFileReference');
test.equal(myProj.pbxFileReferenceSection()[file.fileRef].lastKnownFileType, 'sourcecode.c.objc');
test.equal(myProj.pbxFileReferenceSection()[file.fileRef].name, '"file.m"');
test.equal(myProj.pbxFileReferenceSection()[file.fileRef].path, '"file.m"');
test.equal(myProj.pbxFileReferenceSection()[file.fileRef].sourceTree, '"<group>"');
test.equal(myProj.pbxFileReferenceSection()[file.fileRef].fileEncoding, 4);
test.equal(myProj.pbxFileReferenceSection()[file.fileRef + "_comment"], 'file.m');
test.done();
},
'should add file with preset explicitFileType to fileReferenceSection correctly': function (test) {
var appexFile = { fileRef: myProj.generateUuid(), isa: 'PBXFileReference', explicitFileType: '"wrapper.app-extension"', path: "WatchKit Extension.appex"};
myProj.addToPbxFileReferenceSection(appexFile)
test.equal(myProj.pbxFileReferenceSection()[appexFile.fileRef].isa, 'PBXFileReference');
test.equal(myProj.pbxFileReferenceSection()[appexFile.fileRef].explicitFileType, '"wrapper.app-extension"');
test.equal(myProj.pbxFileReferenceSection()[appexFile.fileRef].path, '"WatchKit Extension.appex"');
test.done();
},
'should add file with preset includeInIndex to fileReferenceSection correctly': function (test) {
var appexFile = { fileRef: myProj.generateUuid(), isa: 'PBXFileReference', includeInIndex: 0, path: "WatchKit Extension.appex"};
myProj.addToPbxFileReferenceSection(appexFile)
test.equal(myProj.pbxFileReferenceSection()[appexFile.fileRef].isa, 'PBXFileReference');
test.equal(myProj.pbxFileReferenceSection()[appexFile.fileRef].includeInIndex, 0);
test.equal(myProj.pbxFileReferenceSection()[appexFile.fileRef].path, '"WatchKit Extension.appex"');
test.done();
},
'should add file with preset sourceTree to fileReferenceSection correctly': function (test) {
var appexFile = { fileRef: myProj.generateUuid(), isa: 'PBXFileReference', sourceTree: 'BUILT_PRODUCTS_DIR', path: "WatchKit Extension.appex"};
myProj.addToPbxFileReferenceSection(appexFile)
test.equal(myProj.pbxFileReferenceSection()[appexFile.fileRef].isa, 'PBXFileReference');
test.equal(myProj.pbxFileReferenceSection()[appexFile.fileRef].sourceTree, 'BUILT_PRODUCTS_DIR');
test.equal(myProj.pbxFileReferenceSection()[appexFile.fileRef].path, '"WatchKit Extension.appex"');
test.done();
}
}