|
1 Tests.prototype.DeviceTests = function() { |
|
2 module('Device Information (window.device)'); |
|
3 test("should exist", function() { |
|
4 expect(1); |
|
5 ok(window.device != null, "window.device should not be null."); |
|
6 }); |
|
7 test("should contain a platform specification that is a string", function() { |
|
8 expect(2); |
|
9 ok(typeof window.device.platform != 'undefined' && window.device.platform != null, "window.device.platform should not be null.") |
|
10 ok((new String(window.device.platform)).length > 0, "window.device.platform should contain some sort of description.") |
|
11 }); |
|
12 test("should contain a version specification that is a string", function() { |
|
13 expect(2); |
|
14 ok(typeof window.device.version != 'undefined' && window.device.version != null, "window.device.version should not be null.") |
|
15 ok((new String(window.device.version)).length > 0, "window.device.version should contain some kind of description.") |
|
16 }); |
|
17 test("should contain a name specification that is a string", function() { |
|
18 expect(2); |
|
19 ok(typeof window.device.name != 'undefined' && window.device.name != null, "window.device.name should not be null.") |
|
20 ok((new String(window.device.name)).length > 0, "window.device.name should contain some kind of description.") |
|
21 }); |
|
22 test("should contain a UUID specification that is a string or a number", function() { |
|
23 expect(2); |
|
24 ok(typeof window.device.uuid != 'undefined' && window.device.uuid != null, "window.device.uuid should not be null.") |
|
25 if (typeof window.device.uuid == 'string' || typeof window.device.uuid == 'object') { |
|
26 ok((new String(window.device.uuid)).length > 0, "window.device.uuid, as a string, should have at least one character.") |
|
27 } else { |
|
28 ok(window.device.uuid > 0, "window.device.uuid, as a number, should be greater than 0. (should it, even?)") |
|
29 } |
|
30 }); |
|
31 }; |