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/mail/base/test/unit/test_viewWrapper_imapFolder.js | |
parent | Initial commit. (diff) | |
download | thunderbird-upstream.tar.xz thunderbird-upstream.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 '')
-rw-r--r-- | comm/mail/base/test/unit/test_viewWrapper_imapFolder.js | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/comm/mail/base/test/unit/test_viewWrapper_imapFolder.js b/comm/mail/base/test/unit/test_viewWrapper_imapFolder.js new file mode 100644 index 0000000000..5e91f587fc --- /dev/null +++ b/comm/mail/base/test/unit/test_viewWrapper_imapFolder.js @@ -0,0 +1,55 @@ +/* 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 DBViewWrapper against a single imap folder. Try and test all the + * features we can without having a fake newsgroup. (Some features are + * newsgroup specific.) + */ + +/* import-globals-from resources/viewWrapperTestUtils.js */ +load("resources/viewWrapperTestUtils.js"); +initViewWrapperTestUtils({ mode: "imap", offline: false }); + +/** + * Create an empty folder, inject messages into it without triggering an + * updateFolder, sanity check that we believe there are no messages in the + * folder, then enter, making sure we immediately enter and that the view + * properly updates to reflect there being the right set of messages. + * (It will fail to update if the db change listener ended up detaching itself + * and not reattaching correctly when the updateFolder completes.) + */ +add_task( + async function test_enter_imap_folder_requiring_update_folder_immediately() { + // - create the folder and wait for the IMAP op to complete + let folderHandle = await messageInjection.makeEmptyFolder(); + let msgFolder = messageInjection.getRealInjectionFolder(folderHandle); + + // - add the messages + let [msgSet] = await messageInjection.makeNewSetsInFolders( + [folderHandle], + [{ count: 1 }], + true + ); + + let viewWrapper = make_view_wrapper(); + + // - make sure we don't know about the message! + Assert.equal(msgFolder.getTotalMessages(false), 0); + + // - sync open the folder, verify we claim we entered, and make sure it has + // nothing in it! + viewWrapper.listener.pendingLoad = true; + viewWrapper.open(msgFolder); + Assert.ok(viewWrapper._enteredFolder); + verify_empty_view(viewWrapper); + + // Wait for all the messages to load. + await gMockViewWrapperListener.promise; + gMockViewWrapperListener.resetPromise(); + + // - make sure the view sees the message though... + verify_messages_in_view(msgSet, viewWrapper); + } +); |