diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /comm/mailnews/imap/test/unit/test_bccProperty.js | |
parent | Initial commit. (diff) | |
download | thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'comm/mailnews/imap/test/unit/test_bccProperty.js')
-rw-r--r-- | comm/mailnews/imap/test/unit/test_bccProperty.js | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/comm/mailnews/imap/test/unit/test_bccProperty.js b/comm/mailnews/imap/test/unit/test_bccProperty.js new file mode 100644 index 0000000000..42795245c7 --- /dev/null +++ b/comm/mailnews/imap/test/unit/test_bccProperty.js @@ -0,0 +1,52 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, you can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* + * Test to ensure that BCC gets added to message headers on IMAP download + * + * adapted from test_downloadOffline.js + * + * original author Kent James <kent@caspia.com> + */ + +var { PromiseTestUtils } = ChromeUtils.import( + "resource://testing-common/mailnews/PromiseTestUtils.jsm" +); + +var gFileName = "draft1"; +var gMsgFile = do_get_file("../../../data/" + gFileName); + +add_setup(async function () { + setupIMAPPump(); + + /* + * Ok, prelude done. Read the original message from disk + * (through a file URI), and add it to the Inbox. + */ + let msgfileuri = Services.io + .newFileURI(gMsgFile) + .QueryInterface(Ci.nsIFileURL); + + IMAPPump.mailbox.addMessage( + new ImapMessage(msgfileuri.spec, IMAPPump.mailbox.uidnext++, []) + ); + + // ...and download for offline use. + let listener = new PromiseTestUtils.PromiseUrlListener(); + IMAPPump.inbox.downloadAllForOffline(listener, null); + await listener.promise; +}); + +add_task(function checkBccs() { + // locate the new message by enumerating through the database + for (let hdr of IMAPPump.inbox.msgDatabase.enumerateMessages()) { + Assert.ok(hdr.bccList.includes("Another Person")); + Assert.ok(hdr.bccList.includes("<u1@example.com>")); + Assert.ok(!hdr.bccList.includes("IDoNotExist")); + } +}); + +add_task(function endTest() { + teardownIMAPPump(); +}); |