summaryrefslogtreecommitdiffstats
path: root/comm/mailnews/local/test/unit/test_pop3Duplicates.js
blob: a863cbb1edf4d010a611ff4327dcbb9f0a51c955 (plain)
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
/**
 * The intent of this file is to test duplicate handling options
 * in the pop3 download code.
 */

/* import-globals-from ../../../test/resources/POP3pump.js */
load("../../../resources/POP3pump.js");

var testSubjects = [
  "[Bug 397009] A filter will let me tag, but not untag",
  "Hello, did you receive my bugmail?",
];

function run_test() {
  // Set duplicate action to be delete duplicates.
  Services.prefs.setIntPref(
    "mail.server.default.dup_action",
    Ci.nsIMsgIncomingServer.deleteDups
  );
  // add 3 messages, 2 of which are duplicates.
  gPOP3Pump.files = [
    "../../../data/bugmail1",
    "../../../data/draft1",
    "../../../data/bugmail1",
  ];
  gPOP3Pump.onDone = continueTest;
  do_test_pending();
  gPOP3Pump.run();
}

function continueTest() {
  // get message headers for the inbox folder
  var msgCount = 0;
  for (let hdr of localAccountUtils.inboxFolder.msgDatabase.enumerateMessages()) {
    Assert.equal(hdr.subject, testSubjects[msgCount++]);
  }
  Assert.equal(msgCount, 2);
  gPOP3Pump = null;
  do_test_finished();
}