Add proper `filetypeForProducttype` test coverage (#72)
* ensure filetypeForProducttype coverage
* cleaner test target descriptions
diff --git a/test/addTarget.js b/test/addTarget.js
index 4eded2b..452262c 100644
--- a/test/addTarget.js
+++ b/test/addTarget.js
@@ -122,5 +122,135 @@
test.ok(!phases);
test.done();
+ },
+ 'should have "wrapper.application" filetype for application product': function (test) {
+ var target = proj.addTarget(TARGET_NAME, 'application');
+ test.ok(target);
+ test.ok(target.pbxNativeTarget);
+ test.ok(target.pbxNativeTarget.productReference);
+
+ var productFile = proj.pbxFileReferenceSection()[target.pbxNativeTarget.productReference];
+ test.ok(productFile);
+ test.ok(productFile.explicitFileType);
+ test.equal(productFile.explicitFileType, '"wrapper.application"');
+
+ test.done();
+ },
+ 'should have "wrapper.app-extension" filetype for app_extension product': function (test) {
+ var target = proj.addTarget(TARGET_NAME, 'app_extension');
+ test.ok(target);
+ test.ok(target.pbxNativeTarget);
+ test.ok(target.pbxNativeTarget.productReference);
+
+ var productFile = proj.pbxFileReferenceSection()[target.pbxNativeTarget.productReference];
+ test.ok(productFile);
+ test.ok(productFile.explicitFileType);
+ test.equal(productFile.explicitFileType, '"wrapper.app-extension"');
+
+ test.done();
+ },
+ 'should have "wrapper.plug-in" filetype for bundle product': function (test) {
+ var target = proj.addTarget(TARGET_NAME, 'bundle');
+ test.ok(target);
+ test.ok(target.pbxNativeTarget);
+ test.ok(target.pbxNativeTarget.productReference);
+
+ var productFile = proj.pbxFileReferenceSection()[target.pbxNativeTarget.productReference];
+ test.ok(productFile);
+ test.ok(productFile.explicitFileType);
+ test.equal(productFile.explicitFileType, '"wrapper.plug-in"');
+
+ test.done();
+ },
+ 'should have "compiled.mach-o.dylib" filetype for command_line_tool product': function (test) {
+ var target = proj.addTarget(TARGET_NAME, 'command_line_tool');
+ test.ok(target);
+ test.ok(target.pbxNativeTarget);
+ test.ok(target.pbxNativeTarget.productReference);
+
+ var productFile = proj.pbxFileReferenceSection()[target.pbxNativeTarget.productReference];
+ test.ok(productFile);
+ test.ok(productFile.explicitFileType);
+ test.equal(productFile.explicitFileType, '"compiled.mach-o.dylib"');
+
+ test.done();
+ },
+ 'should have "compiled.mach-o.dylib" filetype for dynamic_library product': function (test) {
+ var target = proj.addTarget(TARGET_NAME, 'dynamic_library');
+ test.ok(target);
+ test.ok(target.pbxNativeTarget);
+ test.ok(target.pbxNativeTarget.productReference);
+
+ var productFile = proj.pbxFileReferenceSection()[target.pbxNativeTarget.productReference];
+ test.ok(productFile);
+ test.ok(productFile.explicitFileType);
+ test.equal(productFile.explicitFileType, '"compiled.mach-o.dylib"');
+
+ test.done();
+ },
+ 'should have "wrapper.framework" filetype for framework product': function (test) {
+ var target = proj.addTarget(TARGET_NAME, 'framework');
+ test.ok(target);
+ test.ok(target.pbxNativeTarget);
+ test.ok(target.pbxNativeTarget.productReference);
+
+ var productFile = proj.pbxFileReferenceSection()[target.pbxNativeTarget.productReference];
+ test.ok(productFile);
+ test.ok(productFile.explicitFileType);
+ test.equal(productFile.explicitFileType, '"wrapper.framework"');
+
+ test.done();
+ },
+ 'should have "archive.ar" filetype for static_library product': function (test) {
+ var target = proj.addTarget(TARGET_NAME, 'static_library');
+ test.ok(target);
+ test.ok(target.pbxNativeTarget);
+ test.ok(target.pbxNativeTarget.productReference);
+
+ var productFile = proj.pbxFileReferenceSection()[target.pbxNativeTarget.productReference];
+ test.ok(productFile);
+ test.ok(productFile.explicitFileType);
+ test.equal(productFile.explicitFileType, '"archive.ar"');
+
+ test.done();
+ },
+ 'should have "wrapper.cfbundle" filetype for unit_test_bundle product': function (test) {
+ var target = proj.addTarget(TARGET_NAME, 'unit_test_bundle');
+ test.ok(target);
+ test.ok(target.pbxNativeTarget);
+ test.ok(target.pbxNativeTarget.productReference);
+
+ var productFile = proj.pbxFileReferenceSection()[target.pbxNativeTarget.productReference];
+ test.ok(productFile);
+ test.ok(productFile.explicitFileType);
+ test.equal(productFile.explicitFileType, '"wrapper.cfbundle"');
+
+ test.done();
+ },
+ 'should have "wrapper.application" filetype for watch_app product': function (test) {
+ var target = proj.addTarget(TARGET_NAME, 'watch_app');
+ test.ok(target);
+ test.ok(target.pbxNativeTarget);
+ test.ok(target.pbxNativeTarget.productReference);
+
+ var productFile = proj.pbxFileReferenceSection()[target.pbxNativeTarget.productReference];
+ test.ok(productFile);
+ test.ok(productFile.explicitFileType);
+ test.equal(productFile.explicitFileType, '"wrapper.application"');
+
+ test.done();
+ },
+ 'should have "wrapper.app-extension" filetype for watch_extension product': function (test) {
+ var target = proj.addTarget(TARGET_NAME, 'watch_extension');
+ test.ok(target);
+ test.ok(target.pbxNativeTarget);
+ test.ok(target.pbxNativeTarget.productReference);
+
+ var productFile = proj.pbxFileReferenceSection()[target.pbxNativeTarget.productReference];
+ test.ok(productFile);
+ test.ok(productFile.explicitFileType);
+ test.equal(productFile.explicitFileType, '"wrapper.app-extension"');
+
+ test.done();
}
}