How to use parseJSON method in Jest

Best JavaScript code snippet using jest

native.js

Source:native.js Github

copy

Full Screen

...65 return x;66}67var AudioUtils = function(){ };68AudioUtils.prototype.startRecord = function(format) {69 return Bridge.exec('AudioUtils', 'startRecord', parseJSON([format]));70}71AudioUtils.prototype.stopRecord = function() {72 return Bridge.exec('AudioUtils', 'stopRecord', parseJSON([]));73}74AudioUtils.prototype.startVoiceCapture = function(formGUID, onSuccess, onSuccessParams, onFail, onFailParams) {75 return Bridge.exec('AudioUtils', 'startVoiceCapture', parseJSON([formGUID, onSuccess, onSuccessParams? onSuccessParams : new Array(), onFail, onFailParams? onFailParams : new Array()]));76};77function getAudioUtils() {78 return new AudioUtils();79}80var A920Utils = function() { };81A920Utils.prototype.toggleLight = function() {82 Bridge.exec('A920Utils', 'toggleLight', parseJSON([]));83}84A920Utils.prototype.printText = function(text) {85 Bridge.exec('A920Utils', 'printText', parseJSON([text]));86}87A920Utils.prototype.printQrCode = function(dir) {88 Bridge.exec('A920Utils', 'printQrCode', parseJSON([dir]));89}90A920Utils.prototype.readIcc = function(onSuccess, onSuccessParams, onError, onErrorParams,formGUID) {91 Bridge.exec('A920Utils', 'readIcc', parseJSON([formGUID, onSuccess, onSuccessParams, onError, onErrorParams]));92}93A920Utils.prototype.readMag = function(onSuccess, onSuccessParams, onError, onErrorParams, formGUID) {94 Bridge.exec('A920Utils', 'readMag', parseJSON([formGUID, onSuccess, onSuccessParams, onError, onErrorParams]));95}96var Cursor = function(cursor) {97 this.cursor = cursor;98 this.row = new Object();99};100Cursor.prototype.handleSuccess = function() {101}102Cursor.prototype.handleError = function(e) {103 // alert(e);104}105Cursor.prototype.next = function() {106 row = Bridge.exec('Database', 'next', parseJSON([this.cursor.toString()]));107 if (row) {108 this.row = MakerMap.prototype.getInstance(JSON.parse(row));109 } else {110 this.row = EMPTY_MAP;111 }112}113Cursor.prototype.field = function(name, type) {114 if (this.row) {115 if (typeof name == 'string') {116 return this.row.get(name.toUpperCase());117 } else {118 return this.row.get(this.row.get('_metadata')[parseInt(name)-1]);119 }120 } else {121 return null;122 }123}124Cursor.prototype.previous = function() {125 Bridge.exec('Database', 'previous', parseJSON([this.cursor.toString()]));126}127Cursor.prototype.last = function() {128 Bridge.exec('Database', 'last', parseJSON([this.cursor.toString()]));129}130Cursor.prototype.first = function() {131 Bridge.exec('Database', 'first', parseJSON([this.cursor.toString()]));132}133Cursor.prototype.close = function() {134 Bridge.exec('Database', 'close', parseJSON([this.cursor.toString()]));135}136Cursor.prototype.hasdata = function() {137 var result = Bridge.exec('Database', 'hasdata', parseJSON([this.cursor.toString()]));138 return result.toString() === "true";139}140Cursor.prototype.getColumnCount = function() {141 return Bridge.exec('Database', 'getColumnCount', parseJSON([this.cursor.toString()]));142}143var Database = function() {};144Database.prototype.fixParameters = function(p) {145 if (p != null) {146 for ( var i = 0; i < p.length; i++) {147 if (p[i] && ((p[i] instanceof Date) || (p[i].getTime))) {148 p[i] = p[i].getTime();149 };150 }151 }152 return p;153}154Database.prototype.openOrCreateDatabase = function(databaseName) {155 return Bridge.exec('Database', 'openOrCreateDatabase', parseJSON([databaseName]));156};157Database.prototype.execSQL = function(sql, bindParams) {158 var output = Bridge.exec('Database', 'execSQL', parseJSON([top.databaseInstance.toString(), sql, this.fixParameters(bindParams)]));159 return (output == "") ? null : output;160};161Database.prototype.rawQuery = function(sql, bindParams) {162 return new Cursor(Bridge.exec('Database', 'rawQuery', parseJSON([top.databaseInstance.toString(), sql, this.fixParameters(bindParams)])));163};164Database.prototype.beginTransaction = function() {165 Bridge.exec('Database', 'beginTransaction', parseJSON([top.databaseInstance.toString()]));166};167Database.prototype.commitTransaction = function() {168 Bridge.exec('Database', 'commitTransaction', parseJSON([top.databaseInstance.toString()]));169};170Database.prototype.rollbackTransaction = function() {171 Bridge.exec('Database', 'rollbackTransaction', parseJSON([top.databaseInstance.toString()]));172};173var FirebaseDatabaseUtils = function() {};174FirebaseDatabaseUtils.prototype.connect = function() {175 Bridge.exec('FirebaseDatabaseUtils', 'connect', parseJSON([]));176}177FirebaseDatabaseUtils.prototype.onDisconnect = function(node, data) {178 Bridge.exec('FirebaseDatabaseUtils', 'onDisconnect', parseJSON([node, data]));179}180FirebaseDatabaseUtils.prototype.writeData = function(node, udid, data, async, onSuccess, onSuccessParams, errorRule, errorParams) {181 return Bridge.exec('FirebaseDatabaseUtils', 'writeData', parseJSON([node, udid, data,async ? async: false, onSuccess ? onSuccess : "", onSuccessParams ? onSuccessParams : new Array(), errorRule ? errorRule : "", errorParams ? errorParams : new Array() ]));182}183FirebaseDatabaseUtils.prototype.readData = function(formGUID, onSuccess, onSuccessParams, node, filter, orderType, orderData) {184 Bridge.exec('FirebaseDatabaseUtils', 'readData', parseJSON([formGUID, onSuccess, onSuccessParams, node, filter, orderType, orderData]));185}186FirebaseDatabaseUtils.prototype.monitoring = function(formGUID, onSuccess, onSuccessParams, node, filter, orderType, orderData) {187 Bridge.exec('FirebaseDatabaseUtils', 'monitoring', parseJSON([formGUID, onSuccess, onSuccessParams, node, filter, orderType, orderData]));188}189FirebaseDatabaseUtils.prototype.stopMonitoring = function(node) {190 Bridge.exec('FirebaseDatabaseUtils', 'stopMonitoring', parseJSON([node]));191}192function getFirebaseDatabaseUtils() {193 return new FirebaseDatabaseUtils();194}195var GeoFireUtils = function() {};196function getGeoFireUtils() {197 return new GeoFireUtils();198}199GeoFireUtils.prototype.setPosition = function(onSuccess, onSuccessParams, node, key, lat, lgt) {200 Bridge.exec("GeoFireUtils", "setPosition", parseJSON(["{00000000-0000-0000-0000-000000000001}", onSuccess ? onSuccess : "", onSuccessParams ? onSuccessParams : new Array(), node, key, lat, lgt]));201};202GeoFireUtils.prototype.watch = function(onSuccess, onSuccessParams, node, lat, lgt, radius) {203 Bridge.exec("GeoFireUtils", "watch", parseJSON(["{00000000-0000-0000-0000-000000000001}", onSuccess ? onSuccess : "", onSuccessParams ? onSuccessParams : new Array(), node, lat, lgt, radius]));204};205GeoFireUtils.prototype.stopWatching = function() {206 Bridge.exec("GeoFireUtils", "stopWatching", parseJSON([]));207};208var NetworkUtils = function() { this.headers = new Object(); };209function getNetworkUtils() {210 return new NetworkUtils();211}212NetworkUtils.prototype.setRequestHeader = function (paramName, paramValue) {213 this.headers[paramName] = paramValue;214}215NetworkUtils.prototype.handleSuccess = function() {216 window._runner_LastException = false;217}218NetworkUtils.prototype.setRuleOnConnect = function(rule, ruleParams) {219 Bridge.exec('NetworkUtils', 'setRuleOnConnect', parseJSON([rule, ruleParams]));220}221NetworkUtils.prototype.setRuleOnDisconnect = function(rule, ruleParams) {222 Bridge.exec('NetworkUtils', 'setRuleOnDisconnect', parseJSON([rule, ruleParams]));223}224NetworkUtils.prototype.handleError = function(e) {225 var err = new Error(e);226 window._runner_LastException = err;227}228NetworkUtils.prototype.postData = function(url, reqType, data, files) {229 if (top.platform == "ioshtml5") {230 var postHeader = this.headers;231 this.headers = new Object();232 if (files) {233 return Bridge.exec('NetworkUtils', 'postFile', parseJSON([url, data, files]));234 } else {235 var code = parseInt(Math.random() * 99999).toString();236 return Bridge.exec('NetworkUtils', 'postData', parseJSON([url, reqType, this.headers, data, code]));237 }238 } else {239 return Bridge.exec('NetworkUtils', 'postData', parseJSON([url, reqType, this.headers, data, files]));240 }241};242NetworkUtils.prototype.postDataAsync = function(url, data, files, onSuccess, onSuccessParams, onError, onErrorParams, formGUID) {243 Bridge.exec('NetworkUtils', 'postFileAsync', parseJSON([url, data, files, formGUID, onSuccess, onSuccessParams? onSuccessParams : new Array(), onError, onErrorParams? onErrorParams : new Array()]));244 245};246NetworkUtils.prototype.checkInternetConnection = function(success, successParams, fail, failParams) {247 Bridge.exec('NetworkUtils', 'isOnline', parseJSON([success, successParams ? successParams:[], fail, failParams ? failParams : []]));248};249NetworkUtils.prototype.sendImageInBody = function(url, file) {250 return Bridge.exec('NetworkUtils', 'sendImageInBody', parseJSON([url, file]));251};252NetworkUtils.prototype.sendEmail = function(remetente,conteudo,assunto) {253 return Bridge.exec('NetworkUtils', 'sendEmail', parseJSON([conteudo,remetente,assunto]));254};255NetworkUtils.prototype.downloadStart = function(url,fileName) {256 return Bridge.exec('NetworkUtils', 'downloadStart', parseJSON([url,fileName]));257};258NetworkUtils.prototype.postFile = function(url, params, fileField, filePath) {259 return Bridge.exec('NetworkUtils', 'postFile', parseJSON([url, params, fileField, filePath]));260};261NetworkUtils.prototype.sendSoapMessage = function(urlVar, soapAction, content) {262 return Bridge.exec('NetworkUtils', 'sendSoapMessage', parseJSON([urlVar, soapAction, content, "UTF-8"]));263};264NetworkUtils.prototype.postDataHttps = function(url, postData, contentType) {265 return Bridge.exec('NetworkUtils', 'postDataHttps', parseJSON([url, postData, contentType]));266};267NetworkUtils.prototype.networkstatus = function() {268 return Bridge.exec('NetworkUtils', 'networkstatus', parseJSON([]));269};270var FunctionsUtils = function() { this.headers = new Object(); };271function getFunctionsUtils() {272 return new FunctionsUtils();273}274FunctionsUtils.prototype.setRequestHeader = function (paramName, paramValue) {275 this.headers[paramName] = paramValue;276}277FunctionsUtils.prototype.handleSuccess = function() {278 window._runner_LastException = false;279}280FunctionsUtils.prototype.handleError = function(e) {281 var err = new Error(e);282 window._runner_LastException = err;283}284FunctionsUtils.prototype.startKeyBoard = function(e) {285 return Bridge.exec('FunctionsUtils','startKeyBoard', parseJSON([]));286}287FunctionsUtils.prototype.closeKeyBoard = function(x,y) {288 return Bridge.exec('FunctionsUtils', 'closeKeyBoard', parseJSON([x,y]));289}290var FileUtils = function() {291};292FileUtils.prototype.handleSuccess = function() {293 // Success294}295FileUtils.prototype.handleError = function(e) {296 alert(e);297}298FileUtils.prototype.openView = function (url) {299 return Bridge.exec('App', 'openOtherApp', parseJSON([url]));300}301FileUtils.prototype.fileCopy = function(pathFile,newFile) {302 return Bridge.exec('FileUtils','fileCopy', parseJSON([pathFile,newFile]));303}304FileUtils.prototype.fileMoveTo = function(pathFile,newFile) {305 return Bridge.exec('FileUtils','fileMoveTo', parseJSON([pathFile,newFile]));306}307FileUtils.prototype.getExternalStorage = function(e) {308 return Bridge.exec('FileUtils','getExternalStorage', parseJSON([]));309}310FileUtils.prototype.fileOpenReadOnly = function(fileName) {311 return Bridge.exec('FileUtils','fileOpenReadOnly', parseJSON([ fileName ]));312}313FileUtils.prototype.fileOpenWrite = function(fileName, append) {314 return Bridge.exec('FileUtils','fileOpenWrite', parseJSON([ fileName, append ]));315}316FileUtils.prototype.fileReadAllBytes = function(fileRef) {317 return Bridge.exec('FileUtils','fileReadAllBytes', parseJSON([ fileRef ]));318};319FileUtils.prototype.fileReadAllText = function(fileRef) {320 return Bridge.exec('FileUtils','fileReadAllText', parseJSON([ fileRef ]));321};322FileUtils.prototype.fileReadLine = function(fileRef) {323 return Bridge.exec('FileUtils','fileReadLine', parseJSON([ fileRef ]));324};325FileUtils.prototype.fileEoF = function(fileRef) {326 return Bridge.exec('FileUtils','fileEoF', parseJSON([ fileRef ]));327};328FileUtils.prototype.fileAppend = function(fileRef, content) {329 return Bridge.exec('FileUtils','fileAppend', parseJSON([ fileRef, content ]));330};331FileUtils.prototype.fileReadLine = function(fileRef) {332 return Bridge.exec('FileUtils','fileReadLine', parseJSON([ fileRef ]));333};334FileUtils.prototype.fileEoF = function(fileRef) {335 return Bridge.exec('FileUtils','fileEoF', parseJSON([ fileRef ]));336};337FileUtils.prototype.fileClose = function(fileRef) {338 return Bridge.exec('FileUtils','fileClose', parseJSON([ fileRef ]));339};340FileUtils.prototype.fileDataDir = function() {341 return Bridge.exec('FileUtils', 'fileDataDir', parseJSON([]));342};343FileUtils.prototype.fileBase64ToBinary = function(content) {344 return Bridge.exec('FileUtils', 'Base64ToBinary', parseJSON([content]));345};346FileUtils.prototype.binaryToBase64 = function(content) {347 return Bridge.exec('FileUtils', 'binaryToBase64', parseJSON([content]));348};349FileUtils.prototype.fileRename = function(oldPath, newPath) {350 return Bridge.exec('FileUtils', 'fileRename', parseJSON([oldPath, newPath]));351};352FileUtils.prototype.showAlert = function(title, message) {353 Bridge.exec('Utils', 'showAlert', parseJSON([title,message]));354};355FileUtils.prototype.openfilechosser = function(Sucess,Fail,formGUID) {356 Bridge.exec('FileUtils', 'openfilechosser', parseJSON([Sucess,Fail,formGUID]));357};358FileUtils.prototype.confirmshow = function(orderOK, title, message, rule, args, formGUID) {359 Bridge.exec('FileUtils', 'confirmshow', parseJSON([orderOK,title, message, rule, args, formGUID]));360};361var PinpadUtils = function() {362};363function getPinpadUtils() {364 return new PinpadUtils();365}366PinpadUtils.prototype.handleSuccess = function() {367 window._runner_LastException = false;368}369PinpadUtils.prototype.handleError = function(e) {370 var err = new Error(e);371 window._runner_LastException = err;372}373PinpadUtils.prototype.connection = function(serverIP, serverPORT) {374 return Bridge.exec('PinpadUtils', 'connection', parseJSON([serverIP, serverPORT]));375};376PinpadUtils.prototype.verifyConnection = function() {377 return Bridge.exec('PinpadUtils', 'verifyConnection', parseJSON([]));378};379PinpadUtils.prototype.disConnect = function() {380 return Bridge.exec('PinpadUtils', 'disConnect', parseJSON([]));381};382PinpadUtils.prototype.sendMessage = function(message) {383 return Bridge.exec('PinpadUtils', 'sendMessage', parseJSON([message]));384};385PinpadUtils.prototype.awaitingResponse = function(onSuccess, onError) {386 return Bridge.exec('PinpadUtils', 'awaitingResponse',parseJSON([onSuccess, onError]));387};388var WirelessUtils = function() {389};390WirelessUtils.prototype.handleSuccess = function() {391 window._runner_LastException = false;392}393WirelessUtils.prototype.handleError = function(e) {394 var err = new Error(e);395 window._runner_LastException = err;396}397WirelessUtils.prototype.sendFile = function(fileName, mimeType) {398 return Bridge.exec('WirelessUtils', 'sendFile', parseJSON([fileName, mimeType]));399};400WirelessUtils.prototype.sendText = function(title, text) {401 return Bridge.exec('WirelessUtils', 'sendText', parseJSON([title, text]));402};403WirelessUtils.prototype.btExists = function() {404 return Bridge.exec('WirelessUtils', 'btExists', parseJSON([]));405};406WirelessUtils.prototype.btIsActive = function() {407 return Bridge.exec('WirelessUtils', 'btIsActive', parseJSON([]));408};409WirelessUtils.prototype.btActivate = function(force) {410 return Bridge.exec('WirelessUtils', 'btActivate', parseJSON([force]));411};412WirelessUtils.prototype.btDeactivate = function(force) {413 return Bridge.exec('WirelessUtils', 'btDeactivate', parseJSON([force]));414};415WirelessUtils.prototype.btMakeDiscoverable = function() {416 return Bridge.exec('WirelessUtils', 'btDiscoverable', parseJSON([]));417};418WirelessUtils.prototype.btGetPairedDevices = function() {419 return Bridge.exec('WirelessUtils', 'btPairedDevices', parseJSON([]));420};421WirelessUtils.prototype.btSetup = function() {422 return Bridge.exec('WirelessUtils', 'btSetup', parseJSON([]));423};424function getWirelessUtils() {425 return new WirelessUtils();426}427var BarcodeUtils = function() {428};429BarcodeUtils.prototype.handleSuccess = function() {430}431BarcodeUtils.prototype.handleError = function() {432}433BarcodeUtils.prototype.scan = function(onSuccess, onError, bTypes, formreference) {434 Bridge.exec('BarcodeUtils', 'scan', parseJSON([bTypes, onSuccess, onError, formreference]));435};436BarcodeUtils.prototype.generate = function(bTypes) {437 return Bridge.exec('BarcodeUtils', 'generate', parseJSON([bTypes]));438};439function getBarcodeUtils() {440 return new BarcodeUtils();441}442var CameraUtils = function() {443};444CameraUtils.prototype.handleSuccess = function() {445}446CameraUtils.prototype.handleError = function(e) {447 alert(e);448}449CameraUtils.prototype.open = function(sucess,fail,quality,form, options) {450 Bridge.exec('CameraUtils', 'open', parseJSON([sucess,fail,quality,form, options]));451};452CameraUtils.prototype.sendImage = function(obj, form) {453 Bridge.exec('CameraUtils', 'sendImage', parseJSON([obj.id, form]));454};455CameraUtils.prototype.scanCard = function(formGUID, onSuccess, onSuccessParams, onFail, onFailParams) {456 Bridge.exec('CameraUtils', 'scanCard', parseJSON([formGUID, onSuccess, onSuccessParams, onFail, onFailParams]));457};458CameraUtils.prototype.close = function() {459 Bridge.exec('CameraUtils', 'close', parseJSON([]));460};461function getCameraUtils() {462 return new CameraUtils();463}464var AppUtils = function() {465};466AppUtils.prototype.handleSuccess = function() {467}468AppUtils.prototype.handleError = function(e) {469 alert(e);470}471AppUtils.prototype.openMap = function(latitude, longitude) {472 document.location = 'geo:'+latitude+','+longitude+'?q=('+latitude+','+longitude+')';473};474AppUtils.prototype.openYouTube = function(code) {475 document.location = 'vnd.youtube://'+code;476};477function getAppUtils() {478 return new AppUtils();479}480var AuthUtils = function() {481};482AuthUtils.prototype.authSMS = function(formGUID, onSuccess, onSuccessParams, onFail, onFailParams, phone) {483 Bridge.exec('AuthUtils', 'authSMS', parseJSON([formGUID, onSuccess, onSuccessParams, onFail, onFailParams, phone]));484};485AuthUtils.prototype.emailLogin = function(formGUID, onSuccess, onSuccessParams, onFail, onFailParams, email, password) {486 Bridge.exec('AuthUtils', 'emailLogin', parseJSON([formGUID, onSuccess, onSuccessParams, onFail, onFailParams, email, password]));487};488AuthUtils.prototype.tokenLogin = function(formGUID, onSuccess, onSuccessParams, onFail, onFailParams, token) {489 Bridge.exec('AuthUtils', 'tokenLogin', parseJSON([formGUID, onSuccess, onSuccessParams? onSuccessParams : new Array(), onFail, onFailParams? onFailParams : new Array(), token]));490};491AuthUtils.prototype.isUserLoggedIn = function() {492 return Bridge.exec('AuthUtils', 'isUserLoggedIn', parseJSON([]));493};494AuthUtils.prototype.facebookLogin = function(formGUID, onSuccess, onSuccessParams, onFail, onFailParams, facebookParams) {495 Bridge.exec('AuthUtils', 'facebookLogin', parseJSON([formGUID, onSuccess, onSuccessParams, onFail, onFailParams, facebookParams]));496};497AuthUtils.prototype.googleLogin = function(formGUID, onSuccess, onSuccessParams, onFail, onFailParams) {498 Bridge.exec('AuthUtils', 'googleLogin', parseJSON([formGUID, onSuccess, onSuccessParams, onFail, onFailParams]));499};500AuthUtils.prototype.onLogout = function() {501 Bridge.exec('AuthUtils', 'onLogout', parseJSON([]));502};503AuthUtils.prototype.passwordReset = function(formGUID, onSuccess, onSuccessParams, onFail, onFailParams, email) {504 Bridge.exec('AuthUtils', 'passwordReset', parseJSON([formGUID, onSuccess, onSuccessParams, onFail, onFailParams, email]));505};506AuthUtils.prototype.emailVerification = function(formGUID, onSuccess, onSuccessParams, onFail, onFailParams) {507 Bridge.exec('AuthUtils', 'emailVerification', parseJSON([formGUID, onSuccess, onSuccessParams, onFail, onFailParams]));508};509function getAuthUtils() {510 return new AuthUtils();511};512function capturePhoto(onPhotoDataSuccess, onFail, qualityValue) {513 navigator.camera.getPicture(onPhotoDataSuccess, onFail, {destinationType: Camera.DestinationType.FILE_URI, quality: 25, targetWidth: 800, targetHeight: 600 });514};515var LocationUtils = function(){};516LocationUtils.prototype.statusGPS = function() {517 return parseBoolean(Bridge.exec('LocationUtils', 'statusGPS', parseJSON([])));518};519LocationUtils.prototype.enableGPS = function() {520 return parseBoolean(Bridge.exec('LocationUtils', 'enableGPS', parseJSON([])));521};522LocationUtils.prototype.startLocationService = function(formGUID, successRule, succesParams, errorRule, errorParams) {523 return Bridge.exec('LocationUtils', 'startLocationService', parseJSON([formGUID, successRule, succesParams, errorRule, errorParams]));524};525LocationUtils.prototype.getCurrentLocation = function() {526 var json = Bridge.exec('LocationUtils', 'getCurrentLocation', parseJSON([]));527 if(typeof json == 'string'){528 return JSON.parse(json);529 }else{530 return json;531 }532};533LocationUtils.prototype.getGPSLastCoords = function() {534 return Bridge.exec('LocationUtils', 'getGPSLastCoords', parseJSON([]));535};536LocationUtils.prototype.startMonitoringGPS = function(formGUID, monitoringRule, monitoringParams, priority, interval, fastestInterval) {537 return Bridge.exec('LocationUtils', 'startMonitoringGPS', parseJSON([priority, interval, fastestInterval, formGUID, monitoringRule, monitoringParams]));538};539LocationUtils.prototype.disconnect = function() {540 return Bridge.exec('LocationUtils', 'disconnect', parseJSON([]));541};542function getPosition(formGUID, onPositionSuccess, onFail){543 Bridge.exec('LocationUtils', 'currentLocation', parseJSON([formGUID, onPositionSuccess, onFail]));544};545function onSuccessGPS(winTarget, onPositionSuccess, result) {546 list = result.split("|");547 var map = new MakerMap();548 if(!isNullOrEmpty(result)&& result != "-303"){549 map.add(list[0],list[1]);550 map.add(list[2],list[3]);551 map.add(list[4],list[5]);552 map.add(list[6],list[7]);553 map.add(list[8],list[9]);554 map.add(list[10],list[11]);555 map.add(list[12],list[13]);556 getWindow(winTarget).eval(onPositionSuccess).apply(this, [map]);557 }558};559function updateViews(e) {560 for (var i=0;i<views.length;i++) {561 var viewFrame = views[i].getElementsByTagName("iframe")[0];562 if (viewFrame.contentWindow.doResize) {563 viewFrame.contentWindow.doResize(e);564 }565 }566};567var supportsOrientationChange = "onorientationchange" in window;568var orientationEvent = supportsOrientationChange ? "orientationchange" : "resize";569window.addEventListener(orientationEvent, function() {570 if (Math.abs(window.orientation) == 90 && currentOrientation != 90) {571 currentOrientation = 90;572 updateViews();573 }574 if ((Math.abs(window.orientation) == 0 || Math.abs(window.orientation) == 180) && currentOrientation != 0) {575 currentOrientation = 0;576 updateViews();577 }578}, false);579function init(mainView) {580 if (window.innerWidth > window.innerHeight) {581 currentOrientation = 90;582 }583 openView(mainView);584}585var PushNotification = function() {586};587PushNotification.prototype.handleSuccess = function() {588};589PushNotification.prototype.handleError = function(e) {590 alert(e);591}592PushNotification.prototype.register = function(cod, appId, formGUID) {593 if (top.platform == "ioshtml5") {594 return Bridge.exec('PushPlugin', 'register', parseJSON([formGUID, cod, appId]));595 } else {596 return Bridge.exec('PushPlugin', 'register', parseJSON([cod, appId]));597 }598};599PushNotification.prototype.unregister = function(cod) {600 Bridge.exec('PushPlugin', 'unregister', parseJSON([cod]));601};602PushNotification.prototype.getPushId = function() {603 return Bridge.exec('PushPlugin', 'getPushId', parseJSON([]));604};605function getPushNotification() {606 return new PushNotification();607};608if(!window.plugins) {609 window.plugins = {};610}611var Utils = function() {612};613Utils.prototype.OpenUrlOnNewTab = function(winURL) {614 Bridge.exec('Utils', 'OpenUrlOnNewTab', top.parseJSON([winURL]));615};616Utils.prototype.returnNotification = function() {617 Bridge.exec('Utils', 'returnNotification', parseJSON([]));618};619Utils.prototype.createNotification = function(notificationRule, notificationParams, notificationTitle, notificationText, autocancel, ongoing, notificationID) {620 Bridge.exec('Utils', 'createNotification', parseJSON([notificationRule, notificationParams, notificationTitle, notificationText, autocancel, ongoing, notificationID]));621};622Utils.prototype.isInBackground = function() {623 return parseBoolean(Bridge.exec('Utils', 'isInBackground', parseJSON([])));624};625Utils.prototype.handleSuccess = function() {626};627Utils.prototype.handleError = function(e) {628 alert(e);629};630Utils.prototype.configureFirebase = function(path) {631 Bridge.exec('Utils', 'configureFirebase', parseJSON([path]));632};633Utils.prototype.showAlert = function(title,message) {634 Bridge.exec('Utils', 'showAlert', parseJSON([title,message]));635};636Utils.prototype.showConfirm = function(title,message) {637 Bridge.exec('Utils', 'showConfirm', parseJSON([title,message,buttons]));638};639Utils.prototype.printTextBT = function(printerName,content) {640 return Bridge.exec('Utils', 'printTextBT', parseJSON([printerName,content]));641};642Utils.prototype.createsharedpreferences = function(name,valor) {643 return Bridge.exec('Utils', 'createsharedpreferences', parseJSON([name,valor]));644};645Utils.prototype.SetHardwareAccelerated = function(status) {646 return Bridge.exec('Utils', 'SetHardwareAccelerated', parseJSON([status]));647};648Utils.prototype.getallpreferences = function(name) {649 return Bridge.exec('Utils', 'getallpreferences', parseJSON([name]));650};651Utils.prototype.clearpreferences = function(name) {652 return Bridge.exec('Utils', 'clearpreferences', parseJSON([name]));653};654Utils.prototype.startPlaying = function(media) {655 return Bridge.exec('Utils', 'startPlaying', parseJSON([media.src]));656};657Utils.prototype.systemExit = function() {658 if(navigator.app){659 return navigator.app.exitApp();660 } else {661 return Bridge.exec('Utils', 'systemExit', parseJSON([]));662 }663};664Utils.prototype.appBringToFront = function() {665 return Bridge.exec('Utils', 'appBringToFront', parseJSON([]));666};667Utils.prototype.getAppVersion = function() {668 return Bridge.exec('Utils', 'getAppVersion', parseJSON([]));669};670Utils.prototype.getDeviceInfo = function() {671 if (top.platform === "ioshtml5"){672 return Bridge.exec('Utils', 'getDeviceInfo', parseJSON([]))673 }else{674 return JSON.parse(Bridge.exec('Utils', 'getDeviceInfo', parseJSON([])));675 }676};677function getUtils() {678 return new Utils();679};680var Tracking = function() {681};682Tracking.prototype.setid = function(id) {683 return Bridge.exec('Tracking', 'setID', parseJSON([id]));684};685Tracking.prototype.sendView = function(id) {686 return Bridge.exec('Tracking', 'sendView', parseJSON([id]));687};688Tracking.prototype.sendEvent = function(id,rule,component) {689 return Bridge.exec('Tracking', 'sendEvent', parseJSON([id,rule,component]));690};691Tracking.prototype.sendException = function(id) {692 return Bridge.exec('Tracking', 'sendException', parseJSON([id]));693};694function getTracking() {695 return new Tracking();696};697var FingerprintUtils = function() {698};699function getFingerprintUtils() {700 return new FingerprintUtils();701};702FingerprintUtils.prototype.fingerprintValidation = function(formGUID, onSuccess, onSuccessParams, onFail, onFailParams) {703 return Bridge.exec('FingerprintUtils', 'fingerprintValidation', parseJSON([formGUID, onSuccess, onSuccessParams, onFail, onFailParams]));704};705var WazeUtils = function(){ };706WazeUtils.prototype.startSDK = function(endereco, latitude, longitude) {707 Bridge.exec('WazeUtils', 'startSDK', parseJSON([endereco ? endereco:"", latitude, longitude]));708}709WazeUtils.prototype.searchRequestWithNavigation = function(endereco, latitude, longitude) {710 Bridge.exec('WazeUtils', 'searchRequestWithNavigation', parseJSON([endereco ? endereco:"",latitude,longitude]));711}712WazeUtils.prototype.openWaze = function() {713 Bridge.exec('WazeUtils', 'openWaze', parseJSON([]));714}715WazeUtils.prototype.terminateSDK = function() {716 Bridge.exec('WazeUtils', 'terminateSDK', parseJSON([]));717}718WazeUtils.prototype.getWazebuildnumber = function() {719 return Bridge.exec('WazeUtils', 'getWazebuildnumber', parseJSON([]));720}721WazeUtils.prototype.stopNavigationRequest = function() {722 Bridge.exec('WazeUtils', 'stopNavigationRequest', parseJSON([]));723}724function getWazeUtils() {725 return new WazeUtils();726}727function parseJSON(args) {728 if (typeof JSON === "undefined") {729 var s = "[";730 var i, type, start, name, nameType, a;731 for (i = 0; i < args.length; i++) {732 if (args[i] !== null) {733 if (i > 0) {734 s = s + ",";735 }736 type = typeof args[i];737 if ((type === "number") || (type === "boolean")) {738 s = s + args[i];739 } else if (args[i] instanceof Array) {740 s = s + "[" + args[i] + "]";741 } else if (args[i] instanceof Object) {...

Full Screen

Full Screen

App.js

Source:App.js Github

copy

Full Screen

1import React, { useState, useEffect, useRef } from 'react';2import {3 SafeAreaView,4 ScrollView,5 StyleSheet,6 Text,7 View,8 Dimensions,9 TouchableWithoutFeedback,10 ImageBackground,11 Alert,12 Animated,13 UIManager,14 LayoutAnimation,15} from 'react-native';16const chwidth = Dimensions.get('window').width17const chheight = Dimensions.get('window').height18import { NavigationContainer, useNavigation } from '@react-navigation/native';19import { createStackNavigator } from '@react-navigation/stack';20import client from './client'21import { Switch } from 'react-native-switch';22import RNExitApp from 'react-native-kill-app';23import messaging from '@react-native-firebase/messaging';24import AutoHeightImage from 'react-native-auto-height-image';25import { RecoilRoot, useRecoilState, waitForAll } from 'recoil';26import RNRestart from 'react-native-restart';27const alarmbtn = require('./img/alambtn.png')28const redKo = require('./img/redKo.png')29const Stack = createStackNavigator();30const App = () => {31 useEffect(() => {32 const unsubscribe = messaging().onMessage(async remoteMessage => {33 Alert.alert('A new FCM message arrived!', JSON.stringify(remoteMessage));34 });35 return unsubscribe;36 }, []);37 return (38 <NavigationContainer>39 <Stack.Navigator headerMode={"none"}>40 <Stack.Screen name="메인스위치" component={MainSwitch} />41 </Stack.Navigator>42 </NavigationContainer>43 )44}45const oceanImg = require('./img/ocean.png')46const MainSwitch = () => {47 const navigation = useNavigation()48 if (49 Platform.OS === "android" &&50 UIManager.setLayoutAnimationEnabledExperimental51 ) {52 UIManager.setLayoutAnimationEnabledExperimental(true);53 }54 //스타일55 const [circlewidth, setCirclewidth] = useState(0)56 const styles = StyleSheet.create({57 smallcontainer: {58 width: chwidth - 20, height: 70, backgroundColor: 'rgba(13, 13, 13, 0.25)', flexDirection: "row", borderRadius: 10, alignItems: "center", marginBottom: 1059 },60 soltbackONOFFBTN: {61 marginLeft: 4, marginRight: 4, marginTop: 4, alignItems: "center", justifyContent: "center"62 },63 circleStateGreen: {64 flex: 1, height: circlewidth, borderRadius: circlewidth / 2, borderWidth: circlewidth / 6, borderColor: 'white', backgroundColor: '#10DC9E'65 },66 circleStateRed: {67 flex: 1, height: circlewidth, borderRadius: circlewidth / 2, borderWidth: circlewidth / 6, borderColor: 'white', backgroundColor: '#ED1C4E'68 },69 });70 //스타일 끝71 const [switchValue, setSwitchValue] = useState(false)72 const [mainAlarm, setMainAlarm] = useState(false)73 const toggleAlert = () => {74 LayoutAnimation.configureNext(75 LayoutAnimation.create(76 500,77 LayoutAnimation.Types.easeInEaseOut,78 LayoutAnimation.Properties.opacity,79 )80 );81 if (mainAlarm === false) fadin()82 setMainAlarm(mainAlarm === false ? true : false);83 };84 const [salt, setsalt] = useState([85 {86 id: 1,87 state: '0',88 s1: '0',89 s2: '0',90 s3: '0',91 s4: '0',92 },93 {94 id: 2,95 state: '0',96 s1: '0',97 s2: '0',98 s3: '0',99 s4: '0',100 },101 {102 id: 3,103 state: '0',104 s1: '0',105 s2: '0',106 s3: '0',107 s4: '0',108 },109 {110 id: 4,111 state: '0',112 s1: '0',113 s2: '0',114 s3: '0',115 s4: '0',116 },117 {118 id: 5,119 state: '0',120 s1: '0',121 s2: '0',122 s3: '0',123 s4: '0',124 },125 {126 id: 6,127 state: '0',128 s1: '0',129 s2: '0',130 s3: '0',131 s4: '0',132 },133 {134 id: 7,135 state: '0',136 s1: '0',137 s2: '0',138 s3: '0',139 s4: '0',140 },141 {142 id: 8,143 state: '0',144 s1: '0',145 s2: '0',146 s3: '0',147 s4: '0',148 },149 {150 id: 9,151 state: '0',152 s1: '0',153 s2: '0',154 s3: '0',155 s4: '0',156 },157 {158 id: 10,159 state: '0',160 s1: '0',161 s2: '0',162 s3: '0',163 s4: '0',164 },165 {166 id: 11,167 state: '0',168 s1: '0',169 s2: '0',170 s3: '0',171 s4: '0',172 },173 {174 id: 12,175 state: '0',176 s1: '0',177 s2: '0',178 s3: '0',179 s4: '0',180 },181 {182 id: 13,183 state: '0',184 s1: '0',185 s2: '0',186 s3: '0',187 s4: '0',188 },189 {190 id: 14,191 state: '0',192 s1: '0',193 s2: '0',194 s3: '0',195 s4: '0',196 },197 {198 id: 15,199 state: '0',200 s1: '0',201 s2: '0',202 s3: '0',203 s4: '0',204 },205 {206 id: 16,207 state: '0',208 s1: '0',209 s2: '0',210 s3: '0',211 s4: '0',212 },213 {214 id: 17,215 state: '0',216 s1: '0',217 s2: '0',218 s3: '0',219 s4: '0',220 },221 {222 id: 18,223 state: '0',224 s1: '0',225 s2: '0',226 s3: '0',227 s4: '0',228 },229 {230 id: 19,231 state: '0',232 s1: '0',233 s2: '0',234 s3: '0',235 s4: '0',236 },237 {238 id: 20,239 state: '0',240 s1: '0',241 s2: '0',242 s3: '0',243 s4: '0',244 },])245 ///246 function reqState() {247 try {248 client.write('$C,O,0,0')249 console.log('reqState전송!')250 } catch (error) {251 console.log(error)252 exitAlert()253 }254 }255 function startApp() {256 try {257 client.write('$B,O,0,0')258 console.log('startApp전송!')259 } catch (error) {260 console.log(error)261 exitAlert()262 }263 }264 const focusis = navigation.addListener('focus', () => {265 startApp()266 setInterval(() => {267 reqState()268 }, 6000);269 })270 useEffect(() => {271 return () => {272 focusis()273 }274 })275 function exitAlert() {276 console.log('exit')277 RNRestart.Restart()278 } //나가는 알러트를 재부팅으로 완전 바꿔버림. 앱을 재부팅할 필요없이 앱에서 자동으로 재부팅 해줌.279 var offAlertState = true280 function mainoff() {281 console.log('들어옴 : ' + offAlertState)282 if (offAlertState === true) {283 Alert.alert('메인 전원이 꺼져있습니다.', '전원을 켜주세요!')284 offAlertState = false285 }286 }287 useEffect(() => {288 client.on('data', (res) => {289 var command = '' + res290 console.log('데이터 받기 : ' + command)291 //메인전원확인,전원켜져있음 데이터 받기292 if ('' + res == 'main_power_off') {293 setSwitchValue(false)294 mainoff() //꺼져있으니 메인스위치 켜달라 알러트창 표시295 } else if ('' + res == 'state_check') {296 reqState()//상태체크297 } else if (command == 'suc') {298 console.log('suc 넘어옴!')299 } else if (JSON.parse(command).length === 1) {300 var parsejson = JSON.parse(command)301 console.log('잘라진거 하나 받음')302 if (parsejson[0].type === 'main') {303 console.log('메인으로 들어옴')304 if (parsejson[0].power === '1') {305 setSwitchValue(true)306 offAlertState = true307 } else if (parsejson[0].power === '0') {308 setSwitchValue(false)309 mainoff() //꺼져있으니 메인스위치 켜달라 알러트창 표시310 }311 if (parsejson[0].state == 0 && mainAlarm == true) {312 toggleAlert()313 console.log('알람 켜짐 확인')314 } else if (parsejson[0].state == 1 && mainAlarm == false) {315 toggleAlert()316 console.log('알람 켜짐 확인')317 }318 } else if (parsejson[0].type === 'salt') {319 console.log('솔트로 들어옴')320 setsalt(prev => [...prev.slice(0, Number(parsejson[0].name) - 1),321 {322 ...prev[Number(parsejson[0].name) - 1],323 state: parsejson[0].power,324 s1: parsejson[0].state.split(':')[0],325 s2: parsejson[0].state.split(':')[1],326 s3: parsejson[0].state.split(':')[2],327 s4: parsejson[0].state.split(':')[3]328 },329 ...prev.slice(Number(parsejson[0].name), salt.length)330 ])331 }332 }333 else if (JSON.parse(command)[0].power == 1) {334 var parsecmd = JSON.parse(command);335 setSwitchValue(true)336 offAlertState = true337 //알람확인338 if (parsecmd[0].state == 0 && mainAlarm == true) {339 toggleAlert()340 console.log('알람 켜짐 확인')341 } else if (parsecmd[0].state == 1 && mainAlarm == false) {342 toggleAlert()343 console.log('알람 켜짐 확인')344 }345 //데이터 배열에 집어넣기346 match(JSON.stringify(parsecmd))347 }348 })//클라온 끝349 }, [])//useeffect 끝350 function match(json) {351 var parsejson = JSON.parse(json)352 setsalt(perv => [353 {354 ...perv[0],355 state: parsejson[1].power,356 s1: parsejson[1].state.split(':')[0],357 s2: parsejson[1].state.split(':')[1],358 s3: parsejson[1].state.split(':')[2],359 s4: parsejson[1].state.split(':')[3]360 },361 {362 ...perv[1],363 state: parsejson[2].power,364 s1: parsejson[2].state.split(':')[0],365 s2: parsejson[2].state.split(':')[1],366 s3: parsejson[2].state.split(':')[2],367 s4: parsejson[2].state.split(':')[3]368 },369 {370 ...perv[2],371 state: parsejson[3].power,372 s1: parsejson[3].state.split(':')[0],373 s2: parsejson[3].state.split(':')[1],374 s3: parsejson[3].state.split(':')[2],375 s4: parsejson[3].state.split(':')[3]376 },377 {378 ...perv[3],379 state: parsejson[4].power,380 s1: parsejson[4].state.split(':')[0],381 s2: parsejson[4].state.split(':')[1],382 s3: parsejson[4].state.split(':')[2],383 s4: parsejson[4].state.split(':')[3]384 },385 {386 ...perv[4],387 state: parsejson[5].power,388 s1: parsejson[5].state.split(':')[0],389 s2: parsejson[5].state.split(':')[1],390 s3: parsejson[5].state.split(':')[2],391 s4: parsejson[5].state.split(':')[3]392 },393 {394 ...perv[5],395 state: parsejson[6].power,396 s1: parsejson[6].state.split(':')[0],397 s2: parsejson[6].state.split(':')[1],398 s3: parsejson[6].state.split(':')[2],399 s4: parsejson[6].state.split(':')[3]400 },401 {402 ...perv[6],403 state: parsejson[7].power,404 s1: parsejson[7].state.split(':')[0],405 s2: parsejson[7].state.split(':')[1],406 s3: parsejson[7].state.split(':')[2],407 s4: parsejson[7].state.split(':')[3]408 },409 {410 ...perv[7],411 state: parsejson[8].power,412 s1: parsejson[8].state.split(':')[0],413 s2: parsejson[8].state.split(':')[1],414 s3: parsejson[8].state.split(':')[2],415 s4: parsejson[8].state.split(':')[3]416 },417 {418 ...perv[8],419 state: parsejson[9].power,420 s1: parsejson[9].state.split(':')[0],421 s2: parsejson[9].state.split(':')[1],422 s3: parsejson[9].state.split(':')[2],423 s4: parsejson[9].state.split(':')[3]424 },425 {426 ...perv[9],427 state: parsejson[10].power,428 s1: parsejson[10].state.split(':')[0],429 s2: parsejson[10].state.split(':')[1],430 s3: parsejson[10].state.split(':')[2],431 s4: parsejson[10].state.split(':')[3]432 },433 {434 ...perv[10],435 state: parsejson[11].power,436 s1: parsejson[11].state.split(':')[0],437 s2: parsejson[11].state.split(':')[1],438 s3: parsejson[11].state.split(':')[2],439 s4: parsejson[11].state.split(':')[3]440 },441 {442 ...perv[11],443 state: parsejson[12].power,444 s1: parsejson[12].state.split(':')[0],445 s2: parsejson[12].state.split(':')[1],446 s3: parsejson[12].state.split(':')[2],447 s4: parsejson[12].state.split(':')[3]448 },449 {450 ...perv[12],451 state: parsejson[13].power,452 s1: parsejson[13].state.split(':')[0],453 s2: parsejson[13].state.split(':')[1],454 s3: parsejson[13].state.split(':')[2],455 s4: parsejson[13].state.split(':')[3]456 },457 {458 ...perv[13],459 state: parsejson[14].power,460 s1: parsejson[14].state.split(':')[0],461 s2: parsejson[14].state.split(':')[1],462 s3: parsejson[14].state.split(':')[2],463 s4: parsejson[14].state.split(':')[3]464 },465 {466 ...perv[14],467 state: parsejson[15].power,468 s1: parsejson[15].state.split(':')[0],469 s2: parsejson[15].state.split(':')[1],470 s3: parsejson[15].state.split(':')[2],471 s4: parsejson[15].state.split(':')[3]472 },473 {474 ...perv[15],475 state: parsejson[16].power,476 s1: parsejson[16].state.split(':')[0],477 s2: parsejson[16].state.split(':')[1],478 s3: parsejson[16].state.split(':')[2],479 s4: parsejson[16].state.split(':')[3]480 },481 {482 ...perv[16],483 state: parsejson[17].power,484 s1: parsejson[17].state.split(':')[0],485 s2: parsejson[17].state.split(':')[1],486 s3: parsejson[17].state.split(':')[2],487 s4: parsejson[17].state.split(':')[3]488 },489 {490 ...perv[17],491 state: parsejson[18].power,492 s1: parsejson[18].state.split(':')[0],493 s2: parsejson[18].state.split(':')[1],494 s3: parsejson[18].state.split(':')[2],495 s4: parsejson[18].state.split(':')[3]496 },497 {498 ...perv[18],499 state: parsejson[19].power,500 s1: parsejson[19].state.split(':')[0],501 s2: parsejson[19].state.split(':')[1],502 s3: parsejson[19].state.split(':')[2],503 s4: parsejson[19].state.split(':')[3]504 },505 {506 ...perv[19],507 state: parsejson[20].power,508 s1: parsejson[20].state.split(':')[0],509 s2: parsejson[20].state.split(':')[1],510 s3: parsejson[20].state.split(':')[2],511 s4: parsejson[20].state.split(':')[3]512 },513 ])514 console.log('확인 : ')515 }//match 끝 //json형태로 서버에서 들어온 값을 배열에 넣어주는 역활516 useEffect(() => {517 if (switchValue == false) {518 setsalt(perv => [{ ...perv[0], state: '0', }, { ...perv[1], state: '0' }, { ...perv[2], state: '0' }, { ...perv[3], state: '0' }, { ...perv[4], state: '0' }, { ...perv[5], state: '0' }, { ...perv[6], state: '0' }, { ...perv[7], state: '0' }, { ...perv[8], state: '0' }, { ...perv[9], state: '0' }, { ...perv[10], state: '0' }, { ...perv[11], state: '0' }, { ...perv[12], state: '0' }, { ...perv[13], state: '0' }, { ...perv[14], state: '0' }, { ...perv[15], state: '0' }, { ...perv[16], state: '0' }, { ...perv[17], state: '0' }, { ...perv[18], state: '0' }, { ...perv[19], state: '0' }])519 } else if (switchValue == true) {520 reqState()521 }522 }, [switchValue]) //메인 스위치 변경시 실행 함수들, useeffect523 //스위치가 off가 되면 모든 염판을 off상태로 바꾸어줌524 /// 애니메이션 속성525 const fadeAnim = useRef(new Animated.Value(0)).current526 function fadin() {527 Animated.timing(528 fadeAnim,529 {530 toValue: 1,531 duration: 1000,532 useNativeDriver: true533 }534 ).start();535 setTimeout(() => {536 fadout()537 }, 1100);538 }539 function fadout() {540 Animated.timing(541 fadeAnim,542 {543 toValue: 0,544 duration: 1000,545 useNativeDriver: true546 }547 ).start();548 if (mainAlarm == false) {549 setTimeout(() => {550 fadin()551 }, 1100);552 }553 }554 //// 애니메이션 속성 끝555 //염판 정보를 jsx로 변환하여 뿌려주기556 const SaltPush = () => {557 var List = []558 for (var i = 0; i < 20; i++) {559 List.push(<SoltPan key={i} index={i} id={salt[i].id} state={salt[i].state} s1={salt[i].s1} s2={salt[i].s2} s3={salt[i].s3} s4={salt[i].s4}></SoltPan>)560 }561 return List562 }//SaltPush 끝563 //염판 jsx, 프롭으로 받아서 정보 표현하기// 자동으로 값들이 변경되어 보임564 const SoltPan = (prop) => {565 return (566 <View style={{}}>567 <TouchableWithoutFeedback onPress={() => {568 setsalt(prev => [...prev.slice(0, prop.index),569 {570 ...prev[prop.index],571 state: '0',572 },573 ...prev.slice(prop.index + 1, salt.length)574 ])575 try {576 client.write('$S,O,' + prop.id + ',0')577 console.log('염판 ' + prop.id + ' 전송')578 } catch (error) {579 exitAlert()580 }581 setTimeout(() => {582 reqState()583 }, 800);584 }}>585 <View style={styles.smallcontainer}>586 {/* 염판 글자부분 */}587 <View style={{ justifyContent: "center", alignItems: "center", marginTop: 15, marginBottom: 15, marginLeft: 5, flex: 1, }}>588 <View style={{ justifyContent: "center", alignItems: "center", margin: 5, marginLeft: 15, marginRight: 15 }}>589 <Text style={{ color: 'white', fontSize: 20 }}>염판 {prop.id}</Text>590 </View>591 </View>592 {/* 염판 글자부분 끝 */}593 <View style={{ flex: 0.3 }}></View>594 {/* 수문 확인 부분 */}595 <View style={{ flexDirection: 'row', flex: 2 }}>596 {prop.s1 == '0' ?597 <View onLayout={(data) => { setCirclewidth(data.nativeEvent.layout.width) }} style={styles.circleStateGreen}></View> :598 <View onLayout={(data) => { setCirclewidth(data.nativeEvent.layout.width) }} style={styles.circleStateRed}></View>599 }600 <View style={{ flex: 1 }}></View>601 {prop.s2 == '0' ?602 <View style={styles.circleStateGreen}></View> :603 <View style={styles.circleStateRed}></View>604 }605 <View style={{ flex: 1 }}></View>606 {prop.s3 == '0' ?607 <View style={styles.circleStateGreen}></View> :608 <View style={styles.circleStateRed}></View>609 }610 <View style={{ flex: 1 }}></View>611 {prop.s4 == '0' ?612 <View style={styles.circleStateGreen}></View> :613 <View style={styles.circleStateRed}></View>614 }615 </View>616 {/* 수문 확인 부분 끝 // 서클 크기 결정 고민 */}617 <View style={{ flex: 0.3 }}></View>618 </View>619 </TouchableWithoutFeedback>620 {/* off상태 표현창 */}621 {prop.state == '0' && <View style={{ width: chwidth - 20, position: 'absolute', backgroundColor: 'rgba(13, 13, 13, 0.6)', borderRadius: 10 }}>622 <TouchableWithoutFeedback onPress={() => {623 if (switchValue == true) {624 setsalt(prev => [...prev.slice(0, prop.index),625 {626 ...prev[prop.index],627 state: '1',628 },629 ...prev.slice(prop.index + 1, salt.length)630 ])631 try {632 client.write('$S,O,' + prop.id + ',1')633 console.log('염판 ' + prop.id + ' 전송')634 } catch (error) {635 exitAlert()636 }637 setTimeout(() => {638 reqState()639 }, 1000);640 } else {641 Alert.alert('먼저 스위치를 켜주세요')642 }643 }}>644 <View style={{ width: chwidth - 20, height: 70 }}></View>645 </TouchableWithoutFeedback>646 </View>}647 {/* off상태 표현창 끝 */}648 </View>649 )650 }// saltpan 끝651 //메인스위치 return //652 return (653 <SafeAreaView style={{ backgroundColor: 'white' }}>654 <View style={{ width: chwidth, height: '100%', backgroundColor: 'white' }}>655 <ImageBackground source={oceanImg} style={{ width: '100%', height: '100%' }}>656 {/* 헤더 */}657 <View style={{ marginTop: 20, marginLeft: 15, marginBottom: 20, width: chwidth - 25, flexDirection: 'row', justifyContent: 'space-between' }}>658 <View>659 <View style={{ width: 15, height: 5, backgroundColor: 'red', marginBottom: 5 }}></View>660 <TouchableWithoutFeedback onPress={() => { toggleAlert() }}>661 <Text style={{ color: 'white', fontSize: 25, fontFamily: 'Arita-buriB' }}>염전</Text>662 </TouchableWithoutFeedback>663 <View style={{ flexDirection: 'row', alignItems: 'center' }}>664 <Text style={{ color: 'white', fontSize: 25, fontFamily: 'Arita-buriB' }}>스마트 ON, OFF</Text>665 {/* <TouchableWithoutFeedback onPress={() => { RNRestart.Restart() }}>666 <View style={{ width: 50, height: 30, borderRadius: 10, alignItems: 'center', justifyContent: 'center', backgroundColor: 'skyblue', marginLeft: 10 }}>667 <Text style={{ fontSize: 15 }}>restart</Text>668 </View>669 </TouchableWithoutFeedback> */}670 </View>671 </View>672 {/* 스위치 */}673 <View style={{ marginTop: '5%' }}>674 <Switch675 value={switchValue}676 onValueChange={(val) => {677 if (val == true) {678 try {679 client.write('$P,O,1,0')680 } catch (error) {681 exitAlert()682 }683 setTimeout(() => {684 reqState()685 }, 1000);686 } else if (val == false) {687 try {688 client.write('$P,O,0,0')689 } catch (error) {690 exitAlert()691 }692 }693 setSwitchValue(val)694 }}695 disabled={false}696 activeText={'On'}697 inActiveText={'Off'}698 circleSize={40}699 barHeight={55}700 circleBorderWidth={0}701 backgroundActive={'rgb(23,223,162)'}702 backgroundInactive={'red'}703 circleActiveColor={'white'}704 circleInActiveColor={'white'}705 changeValueImmediately={true}706 innerCircleStyle={{ alignItems: "center", justifyContent: "space-between" }}707 outerCircleStyle={{}}708 renderActiveText={true}709 renderInActiveText={true}710 switchLeftPx={5}711 switchRightPx={5}712 switchWidthMultiplier={2.5}713 switchBorderRadius={30}714 />715 </View>716 {/* 스위치 끝 */}717 </View>718 {/* 헤더 끝 */}719 {/* 상태알람 */}720 {721 mainAlarm &&722 <View style={[{723 height: 0, marginLeft: 10, width: chwidth - 20, backgroundColor: 'white', borderRadius: 10, flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', marginBottom: 15724 }, mainAlarm === false ? null : { height: 60 }]}>725 <View style={{ flexDirection: 'row', alignItems: 'center' }}>726 <AutoHeightImage source={alarmbtn} width={40} style={{ margin: 10 }}></AutoHeightImage>727 <Text style={{ fontWeight: 'bold' }}>상태 알람</Text>728 <Animated.View style={{ opacity: fadeAnim }}>729 <AutoHeightImage source={redKo} width={40}></AutoHeightImage>730 </Animated.View>731 </View>732 <TouchableWithoutFeedback onPress={() => {733 try {734 client.write('$E,O,0,0')735 } catch (error) {736 exitAlert()737 }738 setTimeout(() => {739 reqState()740 }, 1000);741 toggleAlert()742 }}>743 <View style={{ width: 70, borderRadius: 8, backgroundColor: 'rgb(221,221,221)', alignItems: 'center', justifyContent: 'center', marginRight: 10 }}>744 <Text style={{ margin: 7 }}>확인</Text>745 </View>746 </TouchableWithoutFeedback>747 </View>748 }749 {/* 상태알람 끝 */}750 {/* 염판 담는 스크롤뷰 */}751 <ScrollView style={{ marginLeft: 10 }} showsVerticalScrollIndicator={false}>752 {/* 염판 */}753 <SaltPush></SaltPush>754 </ScrollView>755 {/* 염판 담는 스크롤뷰 끝 */}756 </ImageBackground>757 </View>758 </SafeAreaView>759 )//메인스위치 return 끝760}...

Full Screen

Full Screen

cssParsing.test.js

Source:cssParsing.test.js Github

copy

Full Screen

...31 result = fullInspector.parseRules(unitTest.parseRules1.input);32 assert.deepEqual(result, expected, 'fi.prototype.parseRules : parse css rules, containing duplicate directives' ); //assert 933});34QUnit.test('Basic CSS parsing', function(assert) {35 var expected = $.parseJSON(testData.veryBasicCSS.output);36 var parsed = fullInspector.parseCSS(testData.veryBasicCSS.input);37 console.log(expected, parsed);38 assert.deepEqual(parsed, expected, 'The simplest css possible, compressed'); //assert 139 expected = $.parseJSON(testData.basicCSS.output);40 parsed = fullInspector.parseCSS(testData.basicCSS.input);41 assert.deepEqual(parsed, expected, 'The simplest css possible, uncompressed'); //assert 242 expected = $.parseJSON(testData.basicCSS2.output); //adding comments should not change output43 parsed = fullInspector.parseCSS(testData.basicCSS2.input);44 assert.deepEqual(parsed, expected, 'Simple css with comments'); //assert 345 expected = $.parseJSON(testData.basicCSS3.output); //a More complex CSS example46 parsed = fullInspector.parseCSS(testData.basicCSS3.input);47 assert.deepEqual(parsed, expected, 'A More complex CSS example'); //assert 448 expected = $.parseJSON(testData.basicCSS4.output); //a More complex CSS example49 parsed = fullInspector.parseCSS(testData.basicCSS4.input);50 assert.deepEqual(parsed, expected, 'Simple css with multi-line value'); //assert 551 expected = $.parseJSON(testData.basicCSS5.output); //simple css with margin value is "*0"52 parsed = fullInspector.parseCSS(testData.basicCSS5.input);53 assert.deepEqual(parsed, expected, 'simple css with margin value is "*0'); //assert 554});55QUnit.test('Advanced CSS Parsing(support for media queries)', function(assert) {56 var expected = $.parseJSON(testData.advCSS.output);57 var parsed = fullInspector.parseCSS(testData.advCSS.input);58 assert.deepEqual(parsed, expected, 'Basic CSS including only 1 media query'); //assert 1 for media queries59 expected = $.parseJSON(testData.advCSS2.output);60 parsed = fullInspector.parseCSS(testData.advCSS2.input);61 assert.deepEqual(parsed, expected, '2 media queries'); //assert 2 for media queries62 //test a very complex css & media query mixup63 expected = $.parseJSON(testData.advCSS3.output);64 parsed = fullInspector.parseCSS(testData.advCSS3.input);65 assert.deepEqual(parsed, expected, 'Complex css & media query mixup'); //assert 2 for media queries66 expected = $.parseJSON(testData.advCSS4.output);67 parsed = fullInspector.parseCSS(testData.advCSS4.input);68 assert.deepEqual(parsed, expected, 'Simple @font-face containing css');69 expected = $.parseJSON(testData.advCSS5.output);70 parsed = fullInspector.parseCSS(testData.advCSS5.input);71 assert.deepEqual(parsed, expected, 'Simple @font-face with multiline value containing css');72 expected = $.parseJSON(testData.advCSS6.output);73 parsed = fullInspector.parseCSS(testData.advCSS6.input);74 assert.deepEqual(parsed, expected, 'Media query with a comment above it.');75});76/*77 this tests convert css string to object, then to string, then to object and compares the last 2 objects78 to detect incostincies79*/80QUnit.test('CSS parse&toString equality tests', function(assert) {81 for (var i in testData) {82 var original = testData[i].input;83 var parsed = fullInspector.parseCSS(original);84 var converted = fullInspector.getCSSForEditor(parsed);85 var reparsed = fullInspector.parseCSS(converted);86 assert.deepEqual(reparsed, parsed, 'Test of each of above test cases');87 }88});89/*90 Test Cases for CSS diff tool91*/92QUnit.test('CSS Diff Tests', function(assert) {93 var css1 = $.parseJSON(diffTestData.diffBasic.css1);94 var css2 = $.parseJSON(diffTestData.diffBasic.css2);95 var diff = fullInspector.cssDiff(css1, css2);96 var expected = $.parseJSON(diffTestData.diffBasic.diff)97 assert.deepEqual(diff, expected, 'Basic cssDiff');98 css1 = $.parseJSON(diffTestData.diffBasic2.css1);99 css2 = $.parseJSON(diffTestData.diffBasic2.css2);100 diff = fullInspector.cssDiff(css1, css2);101 expected = $.parseJSON(diffTestData.diffBasic2.diff)102 assert.deepEqual(diff, expected, 'diff of 2 same css should return false');103});104/*105 Test Cases for Previous css diff bugs106*/107QUnit.test('CSS Diff Bug tests', function(assert) {108 for(var i = 0; i < cssDiffFailedValues.length; i++){109 var testData = cssDiffFailedValues[i];110 console.log('testData ',testData);111 var css1 = $.parseJSON(testData.css1);112 console.log('css 1 ',css1);113 var css2 = $.parseJSON(testData.css2);114 var diff = fullInspector.cssDiff(css1, css2);115 var expected = testData.output;116 assert.deepEqual(diff, expected, 'css diff bug test '+(i+1));117 }118});119/*120 Test Cases for Intelligent CSS Push121*/122QUnit.test('Intelligent CSS Push Tests', function(assert) {123 var styles = $.parseJSON(cssIntelligentPushData.pushBasic.styles);124 var newStyle = $.parseJSON(cssIntelligentPushData.pushBasic.newStyle);125 fullInspector.intelligentCSSPush(styles, newStyle);126 var expected = $.parseJSON(cssIntelligentPushData.pushBasic.result);127 assert.deepEqual(styles, expected, 'Push CSS into empty CSS object');128 styles = $.parseJSON(cssIntelligentPushData.pushBasic2.styles);129 newStyle = $.parseJSON(cssIntelligentPushData.pushBasic2.newStyle);130 fullInspector.intelligentCSSPush(styles, newStyle);131 expected = $.parseJSON(cssIntelligentPushData.pushBasic2.result);132 assert.deepEqual(styles, expected, 'Push CSS containing a new css directive to an existing CSS object');133 styles = $.parseJSON(cssIntelligentPushData.pushBasic3.styles);134 newStyle = $.parseJSON(cssIntelligentPushData.pushBasic3.newStyle);135 fullInspector.intelligentCSSPush(styles, newStyle);136 expected = $.parseJSON(cssIntelligentPushData.pushBasic3.result);137 assert.deepEqual(styles, expected, 'Push media query CSS containing a new css directive to an existing media query CSS object');138});...

Full Screen

Full Screen

inventory.js

Source:inventory.js Github

copy

Full Screen

...132 var websocket = new WebSocket(host);133 websocket.onopen = function (evt) {134 };135 websocket.onmessage = function (evt) {136 $('#layer').html($.parseJSON(evt.data)['layer']);137 $('#dataSize').html($.parseJSON(evt.data)['dataSize']);138 $('#throughput').html($.parseJSON(evt.data)['throughput']);139 $('#dataSizeSum').html($.parseJSON(evt.data)['dataSizeSum']);140 $('#throughputSum').html($.parseJSON(evt.data)['throughputSum']);141 $('#delay').html($.parseJSON(evt.data)['delay']);142 $('#delaySum').html($.parseJSON(evt.data)['delaySum']);143 $('#delayAvg').html($.parseJSON(evt.data)['delayAvg']);144 $('#lossRate').html($.parseJSON(evt.data)['lossRate']);145 $('#sendDataNum').html($.parseJSON(evt.data)['sendDataNum']);146 $('#recvDataNum').html($.parseJSON(evt.data)['recvDataNum']);147 if ($.parseJSON(evt.data)['throughputSum'] != null){148 arrThroughputSum.unshift(parseInt($.parseJSON(evt.data)['throughputSum']));149 console.log(arrThroughputSum);150 }151 if ($.parseJSON(evt.data)['throughput'] != null){152 arrThroughput.unshift(parseInt($.parseJSON(evt.data)['throughput']));153 console.log(arrThroughput);154 }155 //$('#layer').html()156 };157 websocket.onerror = function (evt) {158 };...

Full Screen

Full Screen

deprecated.js

Source:deprecated.js Github

copy

Full Screen

...34 .remove();35} );36QUnit.test( "jQuery.parseJSON", function( assert ) {37 assert.expect( 20 );38 assert.strictEqual( jQuery.parseJSON( null ), null, "primitive null" );39 assert.strictEqual( jQuery.parseJSON( "0.88" ), 0.88, "Number" );40 assert.strictEqual(41 jQuery.parseJSON( "\" \\\" \\\\ \\/ \\b \\f \\n \\r \\t \\u007E \\u263a \"" ),42 " \" \\ / \b \f \n \r \t ~ \u263A ",43 "String escapes"44 );45 assert.deepEqual( jQuery.parseJSON( "{}" ), {}, "Empty object" );46 assert.deepEqual( jQuery.parseJSON( "{\"test\":1}" ), { "test": 1 }, "Plain object" );47 assert.deepEqual( jQuery.parseJSON( "[0]" ), [ 0 ], "Simple array" );48 assert.deepEqual(49 jQuery.parseJSON( "[ \"string\", -4.2, 2.7180e0, 3.14E-1, {}, [], true, false, null ]" ),50 [ "string", -4.2, 2.718, 0.314, {}, [], true, false, null ],51 "Array of all data types"52 );53 assert.deepEqual(54 jQuery.parseJSON( "{ \"string\": \"\", \"number\": 4.2e+1, \"object\": {}," +55 "\"array\": [[]], \"boolean\": [ true, false ], \"null\": null }" ),56 { string: "", number: 42, object: {}, array: [ [] ], "boolean": [ true, false ], "null": null },57 "Dictionary of all data types"58 );59 assert.deepEqual( jQuery.parseJSON( "\n{\"test\":1}\t" ), { "test": 1 },60 "Leading and trailing whitespace are ignored" );61 assert.throws( function() {62 jQuery.parseJSON();63 }, null, "Undefined raises an error" );64 assert.throws( function() {65 jQuery.parseJSON( "" );66 }, null, "Empty string raises an error" );67 assert.throws( function() {68 jQuery.parseJSON( "''" );69 }, null, "Single-quoted string raises an error" );70 assert.throws( function() {71 var result = jQuery.parseJSON( "0101" );72 // Support: IE <=9 only73 // Ensure base-10 interpretation on browsers that erroneously accept leading-zero numbers74 if ( result === 101 ) {75 throw new Error( "close enough" );76 }77 }, null, "Leading-zero number raises an error or is parsed as decimal" );78 assert.throws( function() {79 jQuery.parseJSON( "{a:1}" );80 }, null, "Unquoted property raises an error" );81 assert.throws( function() {82 jQuery.parseJSON( "{'a':1}" );83 }, null, "Single-quoted property raises an error" );84 assert.throws( function() {85 jQuery.parseJSON( "[,]" );86 }, null, "Array element elision raises an error" );87 assert.throws( function() {88 jQuery.parseJSON( "{},[]" );89 }, null, "Comma expression raises an error" );90 assert.throws( function() {91 jQuery.parseJSON( "[]\n,{}" );92 }, null, "Newline-containing comma expression raises an error" );93 assert.throws( function() {94 jQuery.parseJSON( "\"\"\n\"\"" );95 }, null, "Automatic semicolon insertion raises an error" );96 assert.strictEqual( jQuery.parseJSON( [ 0 ] ), 0, "Input cast to string" );97} );98QUnit.test( "jQuery.isArray", function( assert ) {99 assert.expect( 1 );100 assert.strictEqual( jQuery.isArray, Array.isArray, "Array.isArray equals jQuery.isArray" );101} );102QUnit.test( "jQuery.nodeName", function( assert ) {103 assert.expect( 8 );104 assert.strictEqual( typeof jQuery.nodeName, "function", "jQuery.nodeName is a function" );105 assert.strictEqual(106 jQuery.nodeName( document.createElement( "div" ), "div" ),107 true,108 "Basic usage (true)"109 );110 assert.strictEqual(...

Full Screen

Full Screen

parser-util.test.js

Source:parser-util.test.js Github

copy

Full Screen

...16 t.is(error.index, 10);17 t.is(error.message, 'Invalid word');18});19test('parseJSON error', t => {20 const error = t.throws(() => util.parseJSON({21 text: 'something [abc]',22 lastIndex: 1023 }));24 t.is(error.index, 11);25 t.is(error.message, "Invalid JSON: Unknown literal 'abc'");26});27test('parseJSON object error', t => {28 const error = t.throws(() => util.parseJSON({29 text: '{"a", "b"}',30 lastIndex: 031 }));32 t.is(error.index, 4);33 t.is(error.message, "Invalid JSON: Missing character: ':'");34});35test('parseJSON object error 2', t => {36 const error = t.throws(() => util.parseJSON({37 text: '{"a": "b" "c"}',38 lastIndex: 039 }));40 t.is(error.index, 10);41 t.is(error.message, "Invalid JSON: Missing character: ',', '}'");42});43test('parseJSON array error', t => {44 const error = t.throws(() => util.parseJSON({45 text: '["a" "b"]',46 lastIndex: 047 }));48 t.is(error.index, 5);49 t.is(error.message, "Invalid JSON: Missing character: ',', ']'");50});51test('parseJSON multiline string', t => {52 const state = {53 text: '`a\nb`',54 lastIndex: 055 };56 util.parseJSON(state);57 t.is(state.index, 0);58 t.is(state.lastIndex, 5);59 t.is(state.value, 'a\nb');60});61test('parseJSON number', t => {62 const state = {63 text: '123',64 lastIndex: 065 };66 util.parseJSON(state);67 t.is(state.index, 0);68 t.is(state.lastIndex, 3);69 t.is(state.value, 123);70});71test('parseJSON decimal', t => {72 const state = {73 text: '.123',74 lastIndex: 075 };76 util.parseJSON(state);77 t.is(state.index, 0);78 t.is(state.lastIndex, 4);79 t.is(state.value, 0.123);80});81test('parseJSON number exponent', t => {82 const state = {83 text: '1e-1',84 lastIndex: 085 };86 util.parseJSON(state);87 t.is(state.index, 0);88 t.is(state.lastIndex, 4);89 t.is(state.value, 0.1);90});91test('parseJSON prime', t => {92 const state = {93 text: '[true, false, null]',94 lastIndex: 095 };96 util.parseJSON(state);97 t.is(state.index, 0);98 t.is(state.lastIndex, 19);99 t.deepEqual(state.value, [true, false, null]);100});101test('parseEOT error', t => {102 const error = t.throws(() => util.parseEOT({103 text: 'something <<<EOT',104 lastIndex: 10105 }));106 t.is(error.index, 10);107 t.is(error.message, 'Missing EOT');108});109test('parseString backtick', t => {110 const state = {...

Full Screen

Full Screen

Jest Testing Tutorial

LambdaTest’s Jest Testing Tutorial covers step-by-step guides around Jest with code examples to help you be proficient with the Jest framework. The Jest tutorial has chapters to help you learn right from the basics of Jest framework to code-based tutorials around testing react apps with Jest, perform snapshot testing, import ES modules and more.

Chapters

  1. What is Jest Framework
  2. Advantages of Jest - Jest has 3,898,000 GitHub repositories, as mentioned on its official website. Learn what makes Jest special and why Jest has gained popularity among the testing and developer community.
  3. Jest Installation - All the prerequisites and set up steps needed to help you start Jest automation testing.
  4. Using Jest with NodeJS Project - Learn how to leverage Jest framework to automate testing using a NodeJS Project.
  5. Writing First Test for Jest Framework - Get started with code-based tutorial to help you write and execute your first Jest framework testing script.
  6. Jest Vocabulary - Learn the industry renowned and official jargons of the Jest framework by digging deep into the Jest vocabulary.
  7. Unit Testing with Jest - Step-by-step tutorial to help you execute unit testing with Jest framework.
  8. Jest Basics - Learn about the most pivotal and basic features which makes Jest special.
  9. Jest Parameterized Tests - Avoid code duplication and fasten automation testing with Jest using parameterized tests. Parameterization allows you to trigger the same test scenario over different test configurations by incorporating parameters.
  10. Jest Matchers - Enforce assertions better with the help of matchers. Matchers help you compare the actual output with the expected one. Here is an example to see if the object is acquired from the correct class or not. -

|<p>it('check_object_of_Car', () => {</p><p> expect(newCar()).toBeInstanceOf(Car);</p><p> });</p>| | :- |

  1. Jest Hooks: Setup and Teardown - Learn how to set up conditions which needs to be followed by the test execution and incorporate a tear down function to free resources after the execution is complete.
  2. Jest Code Coverage - Unsure there is no code left unchecked in your application. Jest gives a specific flag called --coverage to help you generate code coverage.
  3. HTML Report Generation - Learn how to create a comprehensive HTML report based on your Jest test execution.
  4. Testing React app using Jest Framework - Learn how to test your react web-application with Jest framework in this detailed Jest tutorial.
  5. Test using LambdaTest cloud Selenium Grid - Run your Jest testing script over LambdaTest cloud-based platform and leverage parallel testing to help trim down your test execution time.
  6. Snapshot Testing for React Front Ends - Capture screenshots of your react based web-application and compare them automatically for visual anomalies with the help of Jest tutorial.
  7. Bonus: Import ES modules with Jest - ES modules are also known as ECMAScript modules. Learn how to best use them by importing in your Jest testing scripts.
  8. Jest vs Mocha vs Jasmine - Learn the key differences between the most popular JavaScript-based testing frameworks i.e. Jest, Mocha, and Jasmine.
  9. Jest FAQs(Frequently Asked Questions) - Explore the most commonly asked questions around Jest framework, with their answers.

Run Jest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful