Skip to content

Instantly share code, notes, and snippets.

@arcturus
Created April 29, 2013 15:45
Show Gist options
  • Save arcturus/5482485 to your computer and use it in GitHub Desktop.
Save arcturus/5482485 to your computer and use it in GitHub Desktop.
diff --git a/apps/communications/contacts/js/utilities/sdcard.js b/apps/communications/contacts/js/utilities/sdcard.js
index fadae20..b51c885 100644
--- a/apps/communications/contacts/js/utilities/sdcard.js
+++ b/apps/communications/contacts/js/utilities/sdcard.js
@@ -38,7 +38,7 @@ if (!utils.sdcard) {
/**
* Check whether there is a SD card inserted in the device.
- * @return {Boolean}
+ * @return {Boolean} true if sdcard available, false otherwise.
*/
SdCard.checkStorageCard = function sd_checkStorageCard() {
return SdCard.status === SdCard.AVAILABLE;
diff --git a/apps/communications/contacts/js/utilities/vcard_parser.js b/apps/communications/contacts/js/utilities/vcard_parser.js
index 3f23954..75f1b54 100644
--- a/apps/communications/contacts/js/utilities/vcard_parser.js
+++ b/apps/communications/contacts/js/utilities/vcard_parser.js
@@ -44,7 +44,7 @@ VCFReader.prototype.process = function(cb) {
/**
* Checks if all the contacts have been processed by comparing them to the
* initial number of entries in the vCard
- * @return {Boolean}
+ * @return {Boolean} return true if processed, false otherwise.
*/
VCFReader.prototype.checkIfCompleted = function() {
return this.processedContacts === this.validContacts;
diff --git a/apps/communications/contacts/test/unit/contacts_settings_test.js b/apps/communications/contacts/test/unit/contacts_settings_test.js
index c69bcf7..49e146e 100644
--- a/apps/communications/contacts/test/unit/contacts_settings_test.js
+++ b/apps/communications/contacts/test/unit/contacts_settings_test.js
@@ -5,10 +5,13 @@ requireApp('communications/contacts/test/unit/mock_fb.js');
requireApp('communications/contacts/test/unit/mock_sdcard.js');
requireApp('communications/dialer/test/unit/mock_confirm_dialog.js');
requireApp('communications/contacts/js/contacts_settings.js');
-requireApp('communications/contacts/js/utilities/vcard_parser.js');
+requireApp('communications/contacts/test/unit/mock_vcard_parser.js');
if (!this._) this._ = null;
if (!this.utils) this.utils = null;
+if (!realSdCard) {
+ var realSdcard = null;
+}
var mocksHelperForContactSettings = new MocksHelper([
'Contacts', 'AsyncStorage', 'fb', 'ConfirmDialog'
diff --git a/apps/communications/contacts/test/unit/mock_sdcard.js b/apps/communications/contacts/test/unit/mock_sdcard.js
index ae565e3..d0cf4fc 100644
--- a/apps/communications/contacts/test/unit/mock_sdcard.js
+++ b/apps/communications/contacts/test/unit/mock_sdcard.js
@@ -54,7 +54,7 @@ if (MockSdCard.status === MockSdCard.NOT_INITIALIZED) {
/**
* Check whether there is a SD card inserted in the device.
- * @return {Boolean}
+ * @return {Boolean} return true if sd card present, false otherwise.
*/
MockSdCard.checkStorageCard = function sd_checkStorageCard() {
return MockSdCard.status === MockSdCard.AVAILABLE;
diff --git a/apps/communications/contacts/test/unit/mock_vcard_parser.js b/apps/communications/contacts/test/unit/mock_vcard_parser.js
new file mode 100644
index 0000000..9695bc5
--- /dev/null
+++ b/apps/communications/contacts/test/unit/mock_vcard_parser.js
@@ -0,0 +1,9 @@
+'use strict';
+
+function MockVcardParser(textToParse) {
+ this.text = textToParse;
+}
+
+MockVcardParser.prototype.process = function process(cb) {
+ cb();
+};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment