summaryrefslogtreecommitdiffstats
path: root/comm/mailnews/local/test/unit/test_preview.js
diff options
context:
space:
mode:
Diffstat (limited to 'comm/mailnews/local/test/unit/test_preview.js')
-rw-r--r--comm/mailnews/local/test/unit/test_preview.js40
1 files changed, 40 insertions, 0 deletions
diff --git a/comm/mailnews/local/test/unit/test_preview.js b/comm/mailnews/local/test/unit/test_preview.js
new file mode 100644
index 0000000000..83cfce256b
--- /dev/null
+++ b/comm/mailnews/local/test/unit/test_preview.js
@@ -0,0 +1,40 @@
+var bugmail10 = do_get_file("../../../data/bugmail10");
+var bugmail11 = do_get_file("../../../data/bugmail11");
+var bugmail10_preview =
+ "Do not reply to this email. You can add comments to this bug at https://bugzilla.mozilla.org/show_bug.cgi?id=436880 -- Configure bugmail: https://bugzilla.mozilla.org/userprefs.cgi?tab=email ------- You are receiving this mail because: -----";
+var bugmail11_preview =
+ "Bugzilla has received a request to create a user account using your email address (example@example.org). To confirm that you want to create an account using that email address, visit the following link: https://bugzilla.mozilla.org/token.cgi?t=xxx";
+
+function run_test() {
+ do_test_pending();
+ copyFileMessageInLocalFolder(bugmail10, 0, "", null, copy_next_message);
+}
+
+function copy_next_message(aMessageHeaderKeys, aStatus) {
+ copyFileMessageInLocalFolder(bugmail11, 0, "", null, test_preview);
+}
+
+function test_preview(aMessageHeaderKeys, aStatus) {
+ let headerKeys = aMessageHeaderKeys;
+ Assert.notEqual(headerKeys, null);
+ Assert.equal(headerKeys.length, 2);
+ try {
+ localAccountUtils.inboxFolder.fetchMsgPreviewText(headerKeys, null);
+ Assert.equal(
+ localAccountUtils.inboxFolder
+ .GetMessageHeader(headerKeys[0])
+ .getStringProperty("preview"),
+ bugmail10_preview
+ );
+ Assert.equal(
+ localAccountUtils.inboxFolder
+ .GetMessageHeader(headerKeys[1])
+ .getStringProperty("preview"),
+ bugmail11_preview
+ );
+ } catch (ex) {
+ dump(ex);
+ do_throw(ex);
+ }
+ do_test_finished();
+}