summaryrefslogtreecommitdiff
path: root/StoneIsland/plugins/cordova-plugin-sim/tests/tests.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2017-11-05 20:24:49 +0100
committerJules Laplace <julescarbon@gmail.com>2017-11-05 20:24:49 +0100
commitf828ce6d0c308c2c5d67c71ee3141b015807fd62 (patch)
tree4f5a819afe988158902b907f4f7582448819a594 /StoneIsland/plugins/cordova-plugin-sim/tests/tests.js
parent1f38892c1729572fa98801692dc20c60931d7377 (diff)
cordova-plugin-sim
Diffstat (limited to 'StoneIsland/plugins/cordova-plugin-sim/tests/tests.js')
-rw-r--r--StoneIsland/plugins/cordova-plugin-sim/tests/tests.js48
1 files changed, 48 insertions, 0 deletions
diff --git a/StoneIsland/plugins/cordova-plugin-sim/tests/tests.js b/StoneIsland/plugins/cordova-plugin-sim/tests/tests.js
new file mode 100644
index 00000000..f962fd5e
--- /dev/null
+++ b/StoneIsland/plugins/cordova-plugin-sim/tests/tests.js
@@ -0,0 +1,48 @@
+exports.defineAutoTests = function() {
+ describe('SIM Information (window.plugins.sim)', function () {
+ it('should exist', function() {
+ expect(window.plugins.sim).toBeDefined();
+ });
+
+ it('should contain getSimInfo that is a function', function() {
+ expect(window.plugins.sim.getSimInfo).toBeDefined();
+ expect(typeof window.plugins.sim.getSimInfo).toBe('function');
+ });
+
+ });
+};
+
+exports.defineManualTests = function(contentEl, createActionButton) {
+ var logMessage = function (message, color) {
+ var log = document.getElementById('info');
+ var logLine = document.createElement('div');
+ if (color) {
+ logLine.style.color = color;
+ }
+ logLine.innerHTML = message;
+ log.appendChild(logLine);
+ };
+
+ var clearLog = function () {
+ var log = document.getElementById('info');
+ log.innerHTML = '';
+ };
+
+ var device_tests = '<h3>Press Dump SIM button to get SIM information</h3>' +
+ '<div id="dump_sim"></div>' +
+ 'Expected result: Status box will get updated with SIM info. (i.e. carrierName, countryCode, etc)';
+
+ contentEl.innerHTML = '<div id="info"></div>' + device_tests;
+
+ createActionButton('Dump SIM', function() {
+ clearLog();
+ window.plugins.sim.getSimInfo(
+ function(result) {
+ logMessage(JSON.stringify(result));
+ },
+ function(error) {
+ logMessage(JSON.stringify(error));
+ }
+ );
+ }, 'dump_sim');
+};