]> wagnertech.de Git - kivitendo-erp.git/blobdiff - js/t/example.js
JavaScript-Test-Framework auf Basis von QUnit
[kivitendo-erp.git] / js / t / example.js
diff --git a/js/t/example.js b/js/t/example.js
new file mode 100644 (file)
index 0000000..fbe8df9
--- /dev/null
@@ -0,0 +1,21 @@
+// See http://api.qunitjs.com/ for documentation of available methods
+// (especially the »asserts«).
+
+// Run these tests in your browser by opening the URL
+// …/controller.pl?action=JSTests/run
+
+QUnit.test("example tests", function( assert ) {
+  // Simple true/false tests:
+  assert.ok(1 == "1", "Integer 1 equals string 1");
+
+  // Comparing objects:
+  var actual   = { chunky: "bacon" };
+  var expected = { chunky: "bacon" };
+  assert.deepEqual(actual, expected, "Objects can have equal value");
+
+  // Test if an exception is thrown:
+  assert.throws(function() { throw "Boom!"; });
+
+  // If you want to see how something fails uncomment this:
+  // assert.deepEqual({ we: "are not" }, { in: "Kansas anymore" });
+});