[Pkg-mozext-commits] [perspectives-extension] 34/44: tests - add tests for retrieving strings from stringbundles

David Prévot taffit at moszumanska.debian.org
Sun Jun 26 04:59:21 UTC 2016


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository perspectives-extension.

commit 81f94591c7f644deffb9b09117929b7a8a318a53
Author: Dave Schaefer <dave.schaefer at gmail.com>
Date:   Tue Jun 14 22:09:52 2016 -0700

    tests - add tests for retrieving strings from stringbundles
---
 test/test.html | 43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/test/test.html b/test/test.html
index 3950aab..5930e1e 100644
--- a/test/test.html
+++ b/test/test.html
@@ -990,6 +990,48 @@ function notary_replies() {
     write_string("Finished");
 }
 
+function getStringsFromStringBundles() {
+    write_string("Starting string bundle tests");
+
+    // string keys chosen arbitrarily
+    var nonFormattedStringKey = "quorumDuration";
+    var notFormattedString = Perspectives.getString(nonFormattedStringKey);
+    assert(notFormattedString !== "", "Retrieving the plain string '" +
+        nonFormattedStringKey + "' was not blank: '" + notFormattedString + "'");
+
+    var formattedStringKey = "verifiedMessage";
+    var formattedString = Perspectives.getFormattedString(formattedStringKey,
+        ["firstTestParameter", "secondTestParameter"]);
+    assert(formattedString !== "", "Retrieving the formatted string '" +
+        formattedStringKey + "' was not blank: '" + formattedString + "'");
+
+    var nonExistentStringKey = "ThisKeyDoesNotExist";
+    var exceptionThrown = false;
+    try {
+        var notFormattedString = Perspectives.getString(nonExistentStringKey);
+        assert(notFormattedString !== "", "Retrieving the plain string '" +
+            nonExistentStringKey + "' was not blank: '" + notFormattedString + "'");
+    } catch (e) {
+        exceptionThrown = true;
+    }
+
+    assert(exceptionThrown === true, "Trying to retrive a plain string that doesn't exist throws an exception.");
+
+    exceptionThrown = false;
+    try {
+        var formattedString = Perspectives.getFormattedString(nonExistentStringKey,
+        ["firstTestParameter", "secondTestParameter"]);
+        assert(formattedString !== "", "Retrieving the formatted string '" +
+            nonExistentStringKey + "' was not blank: '" + formattedString + "'");
+    } catch (e) {
+        exceptionThrown = true;
+    }
+
+    assert(exceptionThrown === true, "Trying to retrive a formatted string that doesn't exist throws an exception.");
+
+    write_string("Finished");
+}
+
 
 function run_tests() {
     // check if we are running with chrome privileges or from within browser
@@ -1009,6 +1051,7 @@ function run_tests() {
             quorum_oldkey();
             notary_parsing();
             notary_replies();
+            getStringsFromStringBundles();
 
             write_string("Finished: " + g_pass_count + "/" + g_test_count + " successes, "
                     + g_fail_count + " failures, " + g_known_failure_count +

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/perspectives-extension.git



More information about the Pkg-mozext-commits mailing list