Bug 1519628 - Tweak tests in msgFolderListenerSetup.js to avoid object comparisons. r=aceman
authorJorg K <jorgk@jorgk.com>
Sat, 12 Jan 2019 20:49:59 +0100
changeset 34175 041318b618cfdbadb6d379e7837196a33aaa5508
parent 34174 e01295953e4ce82a16768c70b49fb978d5049c35
child 34176 34939e75acc150fed5fa73ddce2b6154d95e18e3
push id389
push userclokep@gmail.com
push dateMon, 18 Mar 2019 19:01:53 +0000
reviewersaceman
bugs1519628
Bug 1519628 - Tweak tests in msgFolderListenerSetup.js to avoid object comparisons. r=aceman
mailnews/test/resources/msgFolderListenerSetup.js
--- a/mailnews/test/resources/msgFolderListenerSetup.js
+++ b/mailnews/test/resources/msgFolderListenerSetup.js
@@ -226,17 +226,17 @@ function hasExactlyElements(array, eleme
       catch (e) {}
       if (!currElement)
       {
         try {
           currElement = elements.queryElementAt(i, Ci.nsIMsgFolder);
         }
         catch (e) {}
       }
-      Assert.notEqual(currElement, undefined);
+      Assert.equal(typeof currElement, "object");
       Assert.notEqual(mailTestUtils.non_strict_index_of(array, currElement), -1);
     }
   }
   // If a single header or a folder
   else if (elements instanceof Ci.nsIMsgDBHdr || elements instanceof Ci.nsIMsgFolder)
   {
     // Check: there should be only one element in the array.
     Assert.equal(array.length, 1);
@@ -312,17 +312,17 @@ function verify(event)
   case MailServices.mfn.folderMoveCopyCompleted:
     // Check: Move or copy as expected.
     Assert.equal(expected[1], event[1]);
 
     // Check: headers match/folder matches.
     hasExactlyElements(expected[2], event[2]);
 
     // Check: destination folder matches.
-    Assert.equal(expected[3], event[3]);
+    Assert.equal(expected[3].URI, event[3].URI);
 
     if (eventType == MailServices.mfn.folderMoveCopyCompleted)
       break;
 
     // Check: destination headers.  We expect these for local and imap folders,
     //  but we will not have heard about the headers ahead of time,
     //  so the best we can do is make sure they match up.  To this end,
     //  we check that the message-id header values match up.
@@ -330,17 +330,17 @@ function verify(event)
     {
       let srcHdr = event[2].queryElementAt(iMsg, Ci.nsIMsgDBHdr);
       let destHdr = event[4].queryElementAt(iMsg, Ci.nsIMsgDBHdr);
       Assert.equal(srcHdr.messageId, destHdr.messageId);
     }
     break;
   case MailServices.mfn.folderAdded:
     // Check: parent folder matches
-    Assert.equal(expected[1], event[1].parent);
+    Assert.equal(expected[1].URI, event[1].parent.URI);
 
     // Check: folder name matches
     Assert.equal(expected[2], event[1].prettyName);
     Assert.equal(expected[2], event[1].name);
 
     // Not a check, but if we have to store this folder somewhere, do it
     if (expected[3])
       eval(expected[3] + "= event[1]");
@@ -351,12 +351,12 @@ function verify(event)
 
     // Check: destination folder name matches
     Assert.equal(expected[2], event[2].prettyName);
     break;
   case MailServices.mfn.itemEvent:
     // the event string should match
     Assert.equal(expected[2], event[2]);
     // and so should the folder we are talking about
-    Assert.equal(expected[1], event[1]);
+    Assert.equal(expected[1].URI, event[1].URI);
     break;
   }
 }