summaryrefslogtreecommitdiff
path: root/test/synckolab/parser/kolab3
diff options
context:
space:
mode:
authorniko <niko>2012-10-26 12:10:43 (GMT)
committerniko <niko>2012-10-26 12:10:43 (GMT)
commit238dc34ac96a1a1268e2d5e27e07009157920cd2 (patch)
tree093a445feb7e370a0899c0ecd14b79090576e273 /test/synckolab/parser/kolab3
parent15b7152f1e238951bb958dca427af4470261d9ee (diff)
downloadsynckolab-238dc34ac96a1a1268e2d5e27e07009157920cd2.tar.gz
fix utf-8 handling and cleaned contact parsing
Diffstat (limited to 'test/synckolab/parser/kolab3')
-rw-r--r--test/synckolab/parser/kolab3/calendarTest.js1
-rw-r--r--test/synckolab/parser/kolab3/contactTest.js38
-rw-r--r--test/synckolab/parser/kolab3/json/contact.complex.mime.json6
-rw-r--r--test/synckolab/parser/kolab3/xml/contact.complex.mime.xml1
4 files changed, 38 insertions, 8 deletions
diff --git a/test/synckolab/parser/kolab3/calendarTest.js b/test/synckolab/parser/kolab3/calendarTest.js
index 7e9f38d..e3c912b 100644
--- a/test/synckolab/parser/kolab3/calendarTest.js
+++ b/test/synckolab/parser/kolab3/calendarTest.js
@@ -18,6 +18,7 @@ test("kolab3 synckolab.addressbookTools.parseMessageContent", function(){
for(var i = 0; i < testFiles.length; i++) {
var src = testFiles[i];
+ print("INFO: KOLAB 3 TESTING - EVENT: " + src +"\n")
content = readFile("test/synckolab/parser/kolab3/raw/"+src);
content = synckolab.tools.stripMailHeader(content);
diff --git a/test/synckolab/parser/kolab3/contactTest.js b/test/synckolab/parser/kolab3/contactTest.js
index b697529..3a66a08 100644
--- a/test/synckolab/parser/kolab3/contactTest.js
+++ b/test/synckolab/parser/kolab3/contactTest.js
@@ -18,16 +18,13 @@ test("kolab3 synckolab.addressbookTools.parseMessageContent", function(){
for(var i = 0; i < testFiles.length; i++) {
var src = testFiles[i];
-
+ print("INFO: KOLAB 3 TESTING - CONTACT: " + src +"\n")
content = readFile("test/synckolab/parser/kolab3/raw/"+src);
content = synckolab.tools.stripMailHeader(content);
entry = synckolab.addressbookTools.parseMessageContent(content);
- if(entry.isMailList) {
- print(entry.toSource());
- }
content = readFile("test/synckolab/parser/kolab3/json/"+src+".json");
jsonEntry = JSON.parse(content);
- equal(synckolab.tools.equalsObject(entry, jsonEntry), true, src);
+ equal(synckolab.tools.equalsObject(entry, jsonEntry), true, "Json object compare: " + src);
// json -> kolab 3 xml
if(entry.type === "maillist") {
@@ -39,10 +36,39 @@ test("kolab3 synckolab.addressbookTools.parseMessageContent", function(){
if (xmlcontent.replace(/[\n\r\t ]/g, "").length !== content.replace(/[\n\r\t ]/g, "").length) {
equal(xmlcontent.replace(/[\n\r\t ]/g, ""), content.replace(/[\n\r\t ]/g, ""), src);
var diff = diffString(xmlcontent, content);
- print("DIFF FOUND:"+ xmlcontent.replace(/[\n\r\t ]/g, "").length + " vs. "+ content.replace(/[\n\r\t ]/g, "").length +"\n" + diff);
+ print("ERROR: DIFF FOUND:"+ xmlcontent.replace(/[\n\r\t ]/g, "").length + " vs. "+ content.replace(/[\n\r\t ]/g, "").length +"\n" + diff);
}
}
});
+
+/*
+var testFiles = ["contact.complex.mime"];
+for(var i = 0; i < testFiles.length; i++) {
+ var src = testFiles[i];
+ print("KOLAB 3 TESTING: " + src +"\n============")
+ content = readFile("test/synckolab/parser/kolab3/raw/"+src);
+ content = synckolab.tools.stripMailHeader(content);
+ entry = synckolab.addressbookTools.parseMessageContent(content);
+ if(entry.isMailList) {
+ print(entry.toSource());
+ }
+ content = readFile("test/synckolab/parser/kolab3/json/"+src+".json");
+ jsonEntry = JSON.parse(content);
+
+ // json -> kolab 3 xml
+ if(entry.type === "maillist") {
+ content = synckolab.addressbookTools.list2Kolab3(entry);
+ } else {
+ content = synckolab.addressbookTools.card2Kolab3(entry);
+ }
+ xmlcontent = readFile("test/synckolab/parser/kolab3/xml/"+src + ".xml");
+ if (xmlcontent.replace(/[\n\r\t ]/g, "").length !== content.replace(/[\n\r\t ]/g, "").length) {
+ equal(xmlcontent.replace(/[\n\r\t ]/g, ""), content.replace(/[\n\r\t ]/g, ""), src);
+ var diff = diffString(xmlcontent, content);
+ print("DIFF FOUND:"+ xmlcontent.replace(/[\n\r\t ]/g, "").length + " vs. "+ content.replace(/[\n\r\t ]/g, "").length +"\n" + diff);
+ }
+}
+*/
/*
var testFiles = ["list.test1.eml"];
diff --git a/test/synckolab/parser/kolab3/json/contact.complex.mime.json b/test/synckolab/parser/kolab3/json/contact.complex.mime.json
index 9745af3..c2cb6d0 100644
--- a/test/synckolab/parser/kolab3/json/contact.complex.mime.json
+++ b/test/synckolab/parser/kolab3/json/contact.complex.mime.json
@@ -9,8 +9,10 @@
"LastName": "Firstname",
"Notes": "Notes",
"JobTitle": "Title",
- "PhotoType": "inline:image/png",
- "PhotoData": "iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAOTQAADpwB3vacVwAABAVJREFUeJztncFrFGcYxt/szLrJmk2yWTeojQktQluiqNFeKglSQmsOHhRyUApKPbeHQC8taKl4E0Hw4sGToAcvgojVQCg0B+2ph0DprTlYs7SQsNlkdzKzmf4DzxvYsCRP9Pkdn5n53iG/fPDy7TczZkIIIYQQov107PQNtI0vrR/mOfveveap/eAcSXeqRsYdSOwIEkKGhJAhIWRICBkSQsbua3u/slEUj346OoPyUrGEW1Uzm5mfycMDNRtB8ciHIy9RXswXi16NuYU5XOOx1VGsGUKGhJAhIWRICBkSQka40zfgcs6uoHjis4l7KB8fG8+ifPa3Wb9GZJdRPHZq7A7KTx45CWu8/uO1X6NFNEPIkBAyJIQMCSFDQsjYni4rxWtmnVOdsGMyM5s8PfkNyocPDwcor1QrcJwoiNzbOvvF2bsoL5fKsMZidRGOU7OaW6NVNEPIkBAyJIQMCSFDQshob5flbCTr/br3BcrPjJ854Q2V78/DTudt9S08P7YY5uXhslfC4jjGNdZwjaSewHwtXHNrtIpmCBkSQoaEkCEhZEgIGRJCxtba3vN4s1q5NADb2+MfHYMbyRqZBmw7zcxqq3jBLg5xe5tkcEu6buteCUsSfE0cOzUifH4jbLg1WkUzhAwJIUNCyJAQMiSEDL/LumQXvENDhaFHKB/sG4QbyZaiJfgTblLDXYuZWZzHnc56irum9SzOkw6/RtOaOE9xnjTxWJmwff/XmiFkSAgZEkKGhJAhIWT4XVYQuOtMS7Vl+J6ON3+/gedv7NvAA5X8G0uL+HUj5j1eCfu7TfLNjjmlzdlz19XEz3VuBc0QMiSEDAkhQ0LIkBAy/C7rQfOxd2jl6toCygufFJ6jPGlEPSiv5+p+/b1OXnByr/varAHyuinv6QLn/CByG9KW0QwhQ0LIkBAyJIQMCSFDQsjY2ka5+8nvKF6ZXv4Y5YWBnl9R3pfthOebmS1nl/C9dToXOO1wrj/nlbAocVYLvXZ4FcdBs32P2WiGkCEhZEgIGRJChoSQ0d6ncG/bfyheSatHUd71c/dDb6gDuQ+mUL6Y/gNX8tIUt0Z9/7qv7bVKXME74jIbeLXQ+SU6zKjLemeREDIkhAwJIUNCyNieN8p14NWhutUuepdEPzVeofxQbugWyivVRa/78r8A8Zf9CPOBzA0U70lC+PcK0qBtX5nQDCFDQsiQEDIkhAwJIWP3fYPqevg5ig8ePPALynu7e72tdfbnk3m8je54eArF+8v7n6G8mOnza7xwaugbVLsDCSFDQsiQEDIkhAwJIWP3tb0eNw2+MTnoyl7zLmlOx985h/DvwV6Nnk1qfNtaDc0QMiSEDAkhQ0LIkBAhhBBCCPEe8D+b5dDLeP4TXAAAAABJRU5ErkJggg"
+ "Profession": "Profession",
+ "PhotoName": "photo.png",
+ "PhotoType": "inline",
+ "PhotoData": "iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAOTQAADpwB3vacVwAABAVJREFUeJztncFrFGcYxt/szLrJmk2yWTeojQktQluiqNFeKglSQmsOHhRyUApKPbeHQC8taKl4E0Hw4sGToAcvgojVQCg0B+2ph0DprTlYs7SQsNlkdzKz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iQEDIkhAwJIWP3fYPqevg5ig8ePPALynu7e72tdfbnk3m8je54eArF+8v7n6G8mOnza7xwaugbVLsDCSFDQsiQEDIkhAwJIWP3tb0eNw2+MTnoyl7zLmlOx985h/DvwV6Nnk1qfNtaDc0QMiSEDAkhQ0LIkBAhhBBCCPEe8D+b5dDLeP4TXAAAAABJRU5ErkJggg",
"WebPage1": "www.homepage.org",
"WebPage2": "www.blog.test",
"HomeAddress": "Home Street",
diff --git a/test/synckolab/parser/kolab3/xml/contact.complex.mime.xml b/test/synckolab/parser/kolab3/xml/contact.complex.mime.xml
index d6a1683..4eab87d 100644
--- a/test/synckolab/parser/kolab3/xml/contact.complex.mime.xml
+++ b/test/synckolab/parser/kolab3/xml/contact.complex.mime.xml
@@ -76,6 +76,7 @@
<email>
<text>second@email.org</text>
</email>
+ <x-custom><identifier>Profession</identifier><value>Profession</value></x-custom>
<x-custom><identifier>X-AllowRemoteContent</identifier><value>true</value></x-custom>
</vcard>
</vcards> \ No newline at end of file