cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mmo...@apache.org
Subject [34/37] git commit: Feature Branch: First attempt at new-style-tests
Date Mon, 05 May 2014 15:06:55 GMT
Feature Branch: First attempt at new-style-tests


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/commit/a3836e48
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/tree/a3836e48
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/diff/a3836e48

Branch: refs/heads/cdvtest
Commit: a3836e4888a21dd69fb715db60cc38136988c30b
Parents: d7b0855
Author: Michal Mocny <mmocny@gmail.com>
Authored: Fri Oct 11 16:41:43 2013 -0400
Committer: Michal Mocny <mmocny@gmail.com>
Committed: Thu Apr 24 15:54:11 2014 -0400

----------------------------------------------------------------------
 plugin.xml    |  3 +++
 test/tests.js | 39 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/blob/a3836e48/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index a0472be..cedbbd1 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -16,6 +16,9 @@
         <clobbers target="device" />
     </js-module>
 
+    <js-module src="test/tests.js" name="tests">
+    </js-module>
+
     <!-- firefoxos -->
     <platform name="firefoxos">
         <config-file target="config.xml" parent="/*">

http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/blob/a3836e48/test/tests.js
----------------------------------------------------------------------
diff --git a/test/tests.js b/test/tests.js
new file mode 100644
index 0000000..34c0944
--- /dev/null
+++ b/test/tests.js
@@ -0,0 +1,39 @@
+exports.init = function() {
+  eval(require('org.apache.cordova.test.test').injectJasmineInterface(this, 'this'));
+
+  describe('Device Information (window.device)', function () {
+    it("should exist", function() {
+      expect(window.device).toBeDefined();
+    });
+
+    it("should contain a platform specification that is a string", function() {
+      expect(window.device.platform).toBeDefined();
+      expect((new String(window.device.platform)).length > 0).toBe(true);
+    });
+
+    it("should contain a version specification that is a string", function() {
+      expect(window.device.version).toBeDefined();
+      expect((new String(window.device.version)).length > 0).toBe(true);
+    });
+
+    it("should contain a UUID specification that is a string or a number", function() {
+      expect(window.device.uuid).toBeDefined();
+      if (typeof window.device.uuid == 'string' || typeof window.device.uuid == 'object')
{
+        expect((new String(window.device.uuid)).length > 0).toBe(true);
+      } else {
+        expect(window.device.uuid > 0).toBe(true);
+      }
+    });
+
+    it("should contain a cordova specification that is a string", function() {
+      expect(window.device.cordova).toBeDefined();
+      expect((new String(window.device.cordova)).length > 0).toBe(true);
+    });
+
+    it("should contain a model specification that is a string", function() {
+      expect(window.device.model).toBeDefined();
+      expect((new String(window.device.model)).length > 0).toBe(true);
+    });
+  });
+
+};


Mime
View raw message