Best JavaScript code snippet using best
wechat_common.js
Source:wechat_common.js
1function checkRequestFlag(retMap) {2 var requestFlag = false;3 var retcode = retMap.retcode;4 if (retcode == 0) {5 requestFlag = true6 }7 return requestFlag8}9function fenToYuan(fen) {10 if (fen == '') {11 return 012 }13 var yuan = parseFloat(fen / 100);14 return yuan.toFixed(2)15}16function yuanToFen(yuan) {17 if (yuan == '') {18 return 019 }20 var fen = (parseFloat(yuan)).toFixed(2) * 100;21 return Math.ceil(fen)22}23function getPaygwServiceTime(paytype, callback) {24 var url = createUrl("/basicQuery/getPaygwServiceTime");25 var param = {paytype: paytype};26 ajax(url, param, callback, false)27}28function getCardInfo(callback) {29 var url = createUrl("/basicQuery/getCardInfo");30 ajax(url, {}, callback, false)31}32function getXiaoYouCardInfo(sno, account, callback) {33 var url = createUrl("/basicQuery/getXiaoYouCardInfo");34 var param = {sno: sno, account: account};35 ajax(url, param, callback, false)36}37function getSubCardInfo(callback) {38 var url = createUrl("/basicQuery/querySubCardInfo");39 ajax(url, {}, callback, true)40}41function getCardInfo(callback, hideWait) {42 var url = createUrl("/basicQuery/getCardInfo");43 ajax(url, {}, callback, hideWait)44}45function getAccInfo(callback) {46 var url = createUrl("/basicQuery/getAccInfo");47 ajax(url, {}, callback, false)48}49function getAccInfo(callback, hideWait) {50 var url = createUrl("/basicQuery/getAccInfo");51 ajax(url, {}, callback, hideWait)52}53function getIdInfo(callback) {54 var url = createUrl("/basicQuery/getIdInfo");55 ajax(url, {}, callback, false)56}57function getRssList(callback) {58 var url = createUrl("/basicQuery/getRssList");59 ajax(url, {}, callback, false)60}61function queryFixcard(curpage, pagesize, callback) {62 var url = createUrl("/basicQuery/queryFixcard");63 var param = {curpage: curpage, pagesize: pagesize};64 ajax(url, param, callback, true)65}66function queryHisTotal(curpage, pagesize, acctype, query_start, query_end, callback) {67 var url = createUrl("/basicQuery/queryHisTotal");68 var param = {69 curpage: curpage,70 pagesize: pagesize,71 acctype: acctype,72 query_start: query_start,73 query_end: query_end74 };75 ajax(url, param, callback, true)76}77function queryHisConsume(curpage, pagesize, acctype, query_start, query_end, callback) {78 var url = createUrl("/basicQuery/queryHisConsume");79 var param = {80 curpage: curpage,81 pagesize: pagesize,82 acctype: acctype,83 query_start: query_start,84 query_end: query_end85 };86 ajax(url, param, callback, true)87}88function queryHisRecharge(curpage, pagesize, acctype, query_start, query_end, callback) {89 var url = createUrl("/basicQuery/queryHisRecharge");90 var param = {91 curpage: curpage,92 pagesize: pagesize,93 acctype: acctype,94 query_start: query_start,95 query_end: query_end96 };97 ajax(url, param, callback, true)98}99function querySub(curpage, pagesize, acctype, query_start, query_end, callback) {100 var url = createUrl("/basicQuery/querySub");101 var param = {102 curpage: curpage,103 pagesize: pagesize,104 acctype: acctype,105 query_start: query_start,106 query_end: query_end107 };108 ajax(url, param, callback, true)109}110function queryGdcMonthStat(acctype, month, callback) {111 var url = createUrl("/basicQuery/queryGdcMonthStat");112 var param = {acctype: acctype, month: month};113 ajax(url, param, callback, true)114}115function queryApplist(apptype, callback) {116 var url = createUrl("/basicQuery/queryApplist");117 var param = {apptype: apptype};118 ajax(url, param, callback, false)119}120function queryAppInfo(aid, callback) {121 var url = createUrl("/basicQuery/queryAppInfo");122 var param = {aid: aid};123 ajax(url, param, callback, false)124}125function queryNetInfo(aid, payacc, callback) {126 var url = createUrl("/basicQuery/queryNetInfo");127 var param = {aid: aid, payacc: payacc};128 ajax(url, param, callback, false)129}130function queryElecArea(aid, callback) {131 var url = createUrl("/basicQuery/queryElecArea");132 var param = {aid: aid};133 ajax(url, param, callback, false)134}135function queryElecBuilding(aid, area, callback) {136 var url = createUrl("/basicQuery/queryElecBuilding");137 var param = {aid: aid, area: area};138 ajax(url, param, callback, false)139}140function queryElecFloor(aid, area, building, callback) {141 var url = createUrl("/basicQuery/queryElecFloor");142 var param = {aid: aid, area: area, building: building};143 ajax(url, param, callback, false)144}145function queryElecRoom(aid, area, building, floor, callback) {146 var url = createUrl("/basicQuery/queryElecRoom");147 var param = {aid: aid, area: area, building: building, floor: floor};148 ajax(url, param, callback, false)149}150function queryElecRoomInfo(aid, area, building, floor, room, callback) {151 var url = createUrl("/basicQuery/queryElecRoomInfo");152 var param = {aid: aid, area: area, building: building, floor: floor, room: room};153 ajax(url, param, callback, false)154}155function allBill(account, fkaccount, page, rows, startDate, endDate, callback, errcallback) {156 var url = createUrl("/bill/all");157 var param = {158 account: account,159 fkaccount: fkaccount,160 page: page,161 rows: rows,162 startDate: startDate,163 endDate: endDate164 };165 ajaxs(url, param, callback, errcallback, true)166}167function hisRecharge(account, fkaccount, page, rows, startDate, endDate, callback, errcallback) {168 var url = createUrl("/bill/hisRecharge");169 var param = {170 account: account,171 fkaccount: fkaccount,172 page: page,173 rows: rows,174 startDate: startDate,175 endDate: endDate176 };177 ajaxs(url, param, callback, errcallback, true)178}179function hisConsume(account, fkaccount, page, rows, startDate, endDate, callback, errcallback) {180 var url = createUrl("/bill/hisConsume");181 var param = {182 account: account,183 fkaccount: fkaccount,184 page: page,185 rows: rows,186 startDate: startDate,187 endDate: endDate188 };189 ajaxs(url, param, callback, errcallback, true)190}191function hisSub(account, fkaccount, page, rows, startDate, endDate, callback, errcallback) {192 var url = createUrl("/bill/hisSub");193 var param = {194 account: account,195 fkaccount: fkaccount,196 page: page,197 rows: rows,198 startDate: startDate,199 endDate: endDate200 };201 ajaxs(url, param, callback, errcallback, true)202}203function hisRechargeTotal(account, fkaccount, startDate, endDate, callback, errcallback) {204 var url = createUrl("/bill/hisRecTotal");205 var param = {account: account, fkaccount: fkaccount, startDate: startDate, endDate: endDate};206 ajaxs(url, param, callback, errcallback, true)207}208function hisConsumeTotal(account, fkaccount, startDate, endDate, callback, errcallback) {209 var url = createUrl("/bill/hisConsumeTotal");210 var param = {account: account, fkaccount: fkaccount, startDate: startDate, endDate: endDate};211 ajaxs(url, param, callback, errcallback, true)212}213function hisSubTotal(account, fkaccount, startDate, endDate, callback, errcallback) {214 var url = createUrl("/bill/hisSubTotal");215 var param = {account: account, fkaccount: fkaccount, startDate: startDate, endDate: endDate};216 ajaxs(url, param, callback, errcallback, true)217}218function checkPwd(pwd, callback) {219 var url = createUrl("/basicTransaction/checkPwd");220 var param = {pwd: pwd};221 ajax(url, param, callback, false)222}223function checkOtherPwd(account,pwd, callback) {224 var url = createUrl("/basicTransaction/checkPwd");225 var param = {pwd: pwd,account: account};226 ajax(url, param, callback, false)227}228function modifyPwd(password, newpwd, callback) {229 var url = createUrl("/basicTransaction/modifyPwd");230 var param = {password: password, newpwd: newpwd};231 ajax(url, param, callback, false)232}233function modifyAcc(acctype, expire, autotrans_limite, autotrans_amt, autotrans_flag, callback) {234 var url = createUrl("/basicTransaction/modifyAcc");235 var param = {236 acctype: acctype,237 expire: expire,238 autotrans_limite: autotrans_limite,239 autotrans_amt: autotrans_amt,240 autotrans_flag: autotrans_flag241 };242 ajax(url, param, callback, false)243}244function lostCard(password, callback) {245 var url = createUrl("/basicTransaction/lostCard");246 var param = {password: password};247 ajax(url, param, callback, false)248}249function lostSubCard(password, sub_card_account, callback) {250 var url = createUrl("/basicTransaction/lostSubCard");251 var param = {password: password, account: sub_card_account};252 ajax(url, param, callback, false)253}254function unlostCard(password, callback) {255 var url = createUrl("/basicTransaction/unlostCard");256 var param = {password: password};257 ajax(url, param, callback, false)258}259function unlostSubCard(password, sub_card_account, callback) {260 var url = createUrl("/basicTransaction/unlostSubCard");261 var param = {password: password, account: sub_card_account};262 ajax(url, param, callback, false)263}264function modifyRss(consume_alert, balance_alert, rss, callback) {265 var url = createUrl("/basicTransaction/modifyRss");266 var param = {consume_alert: consume_alert, balance_alert: balance_alert, rss: rss};267 ajax(url, param, callback, false)268}269function transfer(password, tranamt, acctype, callback) {270 var url = createUrl("/basicTransaction/transfer");271 var param = {password: password, tranamt: tranamt, acctype: acctype};272 ajax(url, param, callback, false)273}274function wechatRecharge(order_amount, acctype, callback) {275 var url = createUrl("/basicTransaction/wechatRechargeCard");276 var param = {order_amount: order_amount, acctype: acctype};277 ajax(url, param, callback, false)278}279function xiaoyouWechatRecharge(account, sno, order_amount, acctype, callback) {280 var url = createUrl("/basicTransaction/xiaoyouWechatRechargeCard");281 var param = {account: account, sno: sno, order_amount: order_amount, acctype: acctype};282 ajax(url, param, callback, false)283}284function unionpayRecharge(order_amount, acctype, callback) {285 var url = createUrl("/basicTransaction/unionpayRechargeCard");286 var param = {order_amount: order_amount, acctype: acctype};287 ajax(url, param, callback, false)288}289function buildBankCard_Relation(password, bankacc, callback) {290 var url = createUrl("/basicTransaction/buildBankCard_Relation");291 var param = {password: password, bankacc: bankacc};292 ajax(url, param, callback, false)293}294function cancelBankCard_Relation(password, callback) {295 var url = createUrl("/basicTransaction/cancelBankCard_Relation");296 var param = {password: password};297 ajax(url, param, callback, false)298}299function payNetGdc(password, aid, acctype, tranamt, remark, netacc, pkgflag, pkg, callback) {300 var url = createUrl("/basicTransaction/payNetGdc");301 var param = {302 password: password,303 aid: aid,304 acctype: acctype,305 tranamt: tranamt,306 remark: remark,307 netacc: netacc,308 pkgflag: pkgflag,309 pkg: pkg310 };311 ajax(url, param, callback, false)312}313function payNetBank(password, aid, acctype, tranamt, remark, netacc, pkgflag, pkg, payment_acc, callback) {314 var url = createUrl("/basicTransaction/payNetBank");315 var param = {316 password: password,317 aid: aid,318 acctype: acctype,319 tranamt: tranamt,320 remark: remark,321 netacc: netacc,322 pkgflag: pkgflag,323 pkg: pkg,324 payment_acc: payment_acc325 };326 ajax(url, param, callback, false)327}328function payNetPaygw(aid, acctype, order_amount, netacc, pkgflag, pkg, callback) {329 var url = createUrl("/basicTransaction/payNetPaygw");330 var param = {aid: aid, acctype: acctype, order_amount: order_amount, netacc: netacc, pkgflag: pkgflag, pkg: pkg};331 ajax(url, param, callback, false)332}333function payElecGdc(password, aid, acctype, tranamt, remark, area, building, floor, room, meterflag, price, pkgflag, pkg, callback) {334 var url = createUrl("/basicTransaction/payElecGdc");335 var param = {336 password: password,337 aid: aid,338 acctype: acctype,339 tranamt: tranamt,340 remark: remark,341 area: area,342 building: building,343 floor: floor,344 room: room,345 meterflag: meterflag,346 price: price,347 pkgflag: pkgflag,348 pkg: pkg349 };350 ajax(url, param, callback, false)351}352function payElecBank(password, aid, acctype, tranamt, remark, area, building, floor, room, meterflag, price, pkgflag, pkg, payment_acc, callback) {353 var url = createUrl("/basicTransaction/payElecBank");354 var param = {355 password: password,356 aid: aid,357 acctype: acctype,358 tranamt: tranamt,359 remark: remark,360 area: area,361 building: building,362 floor: floor,363 room: room,364 meterflag: meterflag,365 price: price,366 pkgflag: pkgflag,367 pkg: pkg,368 payment_acc: payment_acc369 };370 ajax(url, param, callback, false)371}372function payElecPaygw(aid, acctype, order_amount, area, building, floor, room, meterflag, price, pkgflag, pkg, callback) {373 var url = createUrl("/basicTransaction/payElecPaygw");374 var param = {375 aid: aid,376 acctype: acctype,377 order_amount: order_amount,378 area: area,379 building: building,380 floor: floor,381 room: room,382 meterflag: meterflag,383 price: price,384 pkgflag: pkgflag,385 pkg: pkg386 };387 ajax(url, param, callback, false)388}389function mercaccBarcodePay(password, acctype, merc_barcode, tranamt, dineseq, remark, callback) {390 var url = createUrl("/basicTransaction/mercaccBarcodePay");391 var param = {392 password: password,393 acctype: acctype,394 merc_barcode: merc_barcode,395 tranamt: tranamt,396 dineseq: dineseq,397 remark: remark398 };399 ajax(url, param, callback, false)400}401function littlebagBankTransfer(password, tranamt, smallbag_id, remark, callback) {402 var url = createUrl("/basicTransaction/littlebagBankTransfer");403 var param = {password: password, tranamt: tranamt, smallbag_id: smallbag_id, remark: remark};404 ajax(url, param, callback, false)405}406function littlebagAccTransfer(password, acctype, tranamt, smallbag_id, consumetype, remark, callback) {407 var url = createUrl("/basicTransaction/littlebagAccTransfer");408 var param = {409 password: password,410 acctype: acctype,411 tranamt: tranamt,412 smallbag_id: smallbag_id,413 consumetype: consumetype,414 remark: remark415 };416 ajax(url, param, callback, false)...
app.constants.ts
Source:app.constants.ts
1import { environment } from '../environments/environment';2function createUrl(actionName: string): string {3 return `${environment.apiURL}${actionName}`;4}5export const appVariables = {6 baseUrl:environment.apiURL,7 userLocalStorage: 'user',8 resourceAccessLocalStorage: 'resourceAccessRaw',9 accessTokenServer: 'X-Auth-Token',10 defaultContentTypeHeader: 'application/json',11 loginPageUrl: '',12 registrationPageUrl: '/register',13 errorInputClass: 'has-error',14 successInputClass: 'has-success',15 accessTokenLocalStorage: 'AuthToken'16}17export const appApiPaths = {18 baseUrl: environment.apiURL,19 uploadsPath: `${environment.apiURL}/`,20 login: createUrl('oauth/token'),21 logout: createUrl('api-docs/revokeToken?token='),22 uploadBulkUser: createUrl('api/admin/uploadUserDetails'),23 uploadBulkQuestion: createUrl('api/admin/uploadQuestionBank'),24 getQuestionBank: createUrl('api/admin/getQuestionBank?subLobId='),25 getUserDetails: createUrl('api/admin/getUserDetails'),26 addAssessmentDetails: createUrl('api/admin/submitAssessmentDetails'),27 addAutoAssessmentDetails: createUrl('api/admin/submitAutomaticAssessmentDetails'),28 getUserById: createUrl('api/admin/getUserById?userId='),29 getRole: createUrl('api/admin/getRole'),30 updateUser: createUrl('api/admin/updateUserDetails'), // put request31 addUser: createUrl('api/admin/saveUserDetails'),32 addQuestion: createUrl('api/admin/addQuestion'),33 getAssessmentById: createUrl('api/user/getAssessment?userId='),34 getQuestionSet: createUrl('api/user/getQuestionSet'),35 saveQuizDetais: createUrl('api/user/saveQuizDetails'),36 getRawDataReport: createUrl('api/admin/getRawDataReport?startDate='),37 getUserAssessmentReport: createUrl('api/admin/getUserAssessmentReport?assessmentId='),38 getQuestionReport: createUrl('api/admin/getQuestionReport?questionBankName='),39 getUserReport: createUrl('api/admin/getUserReport?lobId='),40 getDescriptiveAssessment: createUrl('api/admin/getDiscriptiveAssessment?userId='),41 getDescriptiveQuestion: createUrl('api/admin/getDiscriptiveQuesList?assessmentId='),42 saveDescriptiveQuestion: createUrl('api/admin/saveDiscriptiveQuesResult'),43 getQuestionById: createUrl('api/admin/getQuestionById?questionBankName='),44 updateQuestion: createUrl('api/admin/updateQuestion'),45 getAssessmentNameForUserReport: createUrl('api/admin/getAssessmentName?startDate='),46 resetAgentPassword: createUrl('api/user/resetUserPassword'),47 getAllQuestionBank: createUrl('api/admin/getAllQuestionBank?subLobId='),48 updateQuestionBank: createUrl('api/admin/updateQuestionBank'),49 getSummaryReport: createUrl('api/admin/getCountSummaryReport?startDate='),50 // PHASE 2 CHANGES51 saveLob: createUrl('api/admin/saveLob'),52 saveSubLob: createUrl('api/admin/saveSubLob'),53 getAllLob: createUrl('api/admin/getAllLob'),54 getSubLob: createUrl('api/admin/getSubLob?lobName='),55 //AI Reports56 getCategoryWiseAIReport: createUrl('api/admin/getCategoryWiseAlReport?startDate='),57 getLowScoreWiseAIReport: createUrl('api/admin/getLowScoreWiseAlReport?lobId='),58 getHighScoreWiseAIReport: createUrl('api/admin/getHighScoreWiseAlReport?lobId='),59 getQuestionWiseAIReport: createUrl('api/admin/getQuestionWiseAlReport?startDate='),60 getEmployeeWiseSummaryAlReport: createUrl('api/admin/getEmployeeWiseSummaryAlReport?lobId='),61 getEmployeeWiseAlReport: createUrl('api/admin/getEmployeeWiseAlReport?lobId='),62 //sprint 263 forgotPasswordAuthenticationCheck: createUrl('api-docs/forgotPasswordAuthenticationCheck?userId='),64 resetForgotPassword: createUrl('api-docs/resetForgotPassword'),65 saveCategory: createUrl('api/admin/saveCategory'),66 getAllCategory: createUrl('api/admin/getAllCategory'),67 //sprint 2.268 getQuestions: createUrl('api/admin/getQuestions?questionBankName='),69 getAssessmentForEdit: createUrl('api/admin/getAssessmentForEdit?startDate='),70 editAssessmentDetails: createUrl('api/admin/editAssessmentDetails'),71 getFailedUserList: createUrl('api/admin/getFailUserList?assessmentId='),72 //phase 3 - Infographic Reports73 74 //phase 4 - Training Tracker Module75 createTrainingPlan: createUrl('api/admin/createTrainingPlan'),76 getTrainingPlan: createUrl('api/admin/getTrainingPlan?subLobId='),77 deactivateTrainingPlan: createUrl('api/admin/deactivateTrainingPlan'),78 createTrainingBatch: createUrl('api/admin/createTrainingBatch'),79 getTrainingBatch: createUrl('api/admin/getTrainingBatch?startDate='),80 editTrainingBatch: createUrl('api/admin/editTrainingBatch'),81 getUserByRole: createUrl('api/admin/getUserByRole?role='),82 getTrainingBatchForAttendanceCoverage: createUrl('api/admin/getTrainingBatchForAttendanceCoverage?startDate='),83 saveTrainingBatchAttendance: createUrl('api/admin/saveTrainingBatchAttendance'),84 getTraineesAttendance: createUrl('api/admin/getTraineesAttendance?trainingDate='),85 saveTrainingBatchSchedule: createUrl('api/admin/saveTrainingBatchSchedule'),86 getTrainingBatchSchedule: createUrl('api/admin/getTrainingBatchSchedule?trainingPlanId='),87 getTrainingBatchBySubLob: createUrl('api/admin/getTrainingBatchBySubLob?subLobId='),88 getBatchSpecificReport: createUrl('api/admin/getTrainingBatchReport?trainingBatchId=')89}90export const localStorageVariables = {91 AuthInfo : 'AuthInfo'92}93export const appLocationList = ['PUNE', 'CHENNAI', 'COIMBATORE', 'VIJAYAWADA'];94// export const appCategoryList = ['Technical', 'Behaviour', 'Domain', 'Process'];95export const appGenderList = ['MALE','FEMALE','OTHER'];96export const digitPattern = '^(0|[1-9][0-9]*)$'; // regex for checking numerical input97export const stringPattern = '^([a-zA-Z .]*)$'; 98export const subBandPattern = '^[E]([0-9].[0-9]]*)$'; 99export const authUserName = 'statestreet-client';100export const authPassword = 'statestreet-secret';101export const appGenericErr = 'Error Occured! Please try again later.';102export const appSessionErr = 'Session Expired, Please Sign In again.';103export const appUserStatus = ['Active','Deactive'];104export const appQuestionStatus = ['Active','Deactive'];105export const snackBarDuration = 7 * 1000; // 7 Seconds106export const appAssessmentFrequency = ['Weekly', 'Bi-Weekly', 'Monthly'];107export const appTrainingBatchStatus = [108 {code: 'Not_Started_Yet',109 value: 'Not Started Yet'},110 {code: 'Active_In_Progress',111 value: 'Active In Progress'},112 {code: 'Completed',113 value: 'Completed'},114 {code: 'Active_Over_Due',115 value: 'Active Over Due'},116 {code: 'Deactivate',117 value: 'Deactivate'}118];119export const appTrainingScheduleStatus = [120 {code: 'Yet_To_Start', value: 'Yet To Start'},121 {code: 'In_Progress', value: 'In Progress'},122 {code: 'Completed', value: 'Completed'},123 {code: 'Overdue', value: 'Overdue'}124];125export const appWeeks =[{name:'Week 1', code:'week1'},126 {name:'Week 2', code:'week2'},127 {name:'Week 3', code:'week3'},128 {name:'Week 4', code:'week4'},129 {name:'Week 5', code:'week5'},130 {name:'Week 6', code:'week6'},131 {name:'Week 7', code:'week7'},132 {name:'Week 8', code:'week8'}];133export function resetLocalStorage(){134 localStorage.clear();...
asseturls.js
Source:asseturls.js
1// This helps for organising the urls and also2// allows autocompletion because these urls3// are being passed to js by a inline script in4// the home.html django template5function createUrl (filepath) {6 return assetUrl.replace('ASSETPATH', filepath)7}8const urls = {9 typerIcon: createUrl('icons/typericon.svg'),10 backgroundLight: createUrl('pictures/backgroundlight.jpg'),11 backgroundDark: createUrl('pictures/backgrounddark.jpg'),12 enterIcon: createUrl('icons/enterkeybox.svg'),13 homeIcon: createUrl('icons/home.svg'),14 skipIcon: createUrl('icons/skipicon.svg'),15 infoIcon: createUrl('icons/infoicon.svg'),16 perfectImage: createUrl('pictures/perfectimage.svg'),17 backToWord: createUrl('icons/backtoword.svg'),18 loadingBalls: createUrl('animations/loadingballs.riv'),19 retry: createUrl('icons/retry.svg'),20 addQueue: createUrl('icons/addqueue.svg'),21 wpm: createUrl('icons/wpm.svg'),22 accuracy: createUrl('icons/accuracy.svg'),23 queueItemGo: createUrl('icons/queueitemgo.svg'),24 queue: createUrl('icons/queue.svg'),25 drag: createUrl('icons/drag.svg'),26 trash: createUrl('icons/trash.svg'),27 settings: createUrl('icons/settings.svg'),28 close: createUrl('icons/close.svg'),29 stats: createUrl('icons/stats.svg'),30 thinking: createUrl('icons/thinking.svg'),31 rocket: createUrl('icons/rocket.svg'),32 github: createUrl('icons/github.svg')33}...
createURL.js
Source:createURL.js
...3const assert = require('assert');4const plugins = require('../../ditto/plugins/index');5describe('createURL plugin', function(){6 it('should create a url from passed parameters', function(){7 assert.equal(plugins.createURL("http://linkedin.com", "/in/ahmadassaf"), "http://linkedin.com/in/ahmadassaf");8 assert.equal(plugins.createURL("http://linkedin.com", "/in/AHMADASSAF"), "http://linkedin.com/in/ahmadassaf");9 assert.equal(plugins.createURL("http://LinKEDIN.com", " /in/AHMADASSAF "), "http://linkedin.com/in/ahmadassaf");10 assert.equal(plugins.createURL("http://LinKEDIN.com"), "http://linkedin.com");11 assert.equal(plugins.createURL("http://LinKEDIN.com "), "http://linkedin.com");12 });13 it('should return null if no valid string is passed as a parameter', function(){14 assert.equal(plugins.createURL(), null);15 assert.equal(plugins.createURL(true), null);16 assert.equal(plugins.createURL({}), null);17 assert.equal(plugins.createURL(["test"]), null);18 assert.equal(plugins.createURL(undefined), null);19 });...
Using AI Code Generation
1var bestbuy = require('bestbuy')(process.env.BESTBUY_API_KEY);2var url = bestbuy.products('search=galaxy', {show: 'sku,name,salePrice', pageSize: 1, page: 1, sort: 'sku.asc'}).createURL();3console.log(url);4var bestbuy = require('bestbuy')(process.env.BESTBUY_API_KEY);5var url = bestbuy.products('search=galaxy', {show: 'sku,name,salePrice', pageSize: 1, page: 1, sort: 'sku.asc'}).createURL();6console.log(url);7var bestbuy = require('bestbuy')(process.env.BESTBUY_API_KEY);8var url = bestbuy.products('search=galaxy', {show: 'sku,name,salePrice', pageSize: 1, page: 1, sort: 'sku.asc'}).createURL();9console.log(url);10var bestbuy = require('bestbuy')(process.env.BESTBUY_API_KEY);11var url = bestbuy.products('search=galaxy', {show: 'sku,name,salePrice', pageSize: 1, page: 1, sort: 'sku.asc'}).createURL();12console.log(url);13var bestbuy = require('bestbuy
Using AI Code Generation
1var BestBuy = require('bestbuy')(process.env.API_KEY);2var url = BestBuy.products('search=ipod', {show: 'sku,name,salePrice', page: 1, pageSize: 5, format: 'json'});3console.log(url);4var BestBuy = require('bestbuy')(process.env.API_KEY);5var url = BestBuy.products('search=ipod', {show: 'sku,name,salePrice', page: 1, pageSize: 5, format: 'json'});6console.log(url);7var BestBuy = require('bestbuy')(process.env.API_KEY);8var url = BestBuy.products('search=ipod', {show: 'sku,name,salePrice', page: 1, pageSize: 5, format: 'json'});9console.log(url);10var BestBuy = require('bestbuy')(process.env.API_KEY);11var url = BestBuy.products('search=ipod', {show: 'sku,name,salePrice', page: 1, pageSize: 5, format: 'json'});12console.log(url);13var BestBuy = require('bestbuy')(process.env.API_KEY);14var url = BestBuy.products('search=ipod', {show: 'sku,name,salePrice', page: 1, pageSize: 5, format: 'json'});15console.log(url);16var BestBuy = require('bestbuy')(process.env.API_KEY);17var url = BestBuy.products('search=ipod', {show: 'sku,name,salePrice', page: 1, pageSize: 5, format: 'json'});18console.log(url);19var BestBuy = require('bestbuy')(process.env.API_KEY);20var url = BestBuy.products('search=ipod', {show: 'sku,name,salePrice', page: 1, pageSize: 5, format: 'json'});21console.log(url);
Using AI Code Generation
1var bestBuy = require('bestbuy')('API_KEY');2var url = bestBuy.products('(search=apple&categoryPath.id in(cat02001))', {show: 'sku,name,salePrice,regularPrice,image', format: 'json'}).createURL();3console.log(url);4#### bestBuy.categories([query], [options])5#### bestBuy.products([query], [options])6#### bestBuy.stores([query], [options])
Using AI Code Generation
1var BestBuy = require('./BestBuy.js');2var bb = new BestBuy();3bb.createURL('playstation 4', 10, 50, 100, 1000, 20, 50, 100, 1000);4console.log(bb.url);5bb.getProducts(function(products){6 console.log(products);7});8var request = require('request');9var cheerio = require('cheerio');10function BestBuy() {11 this.url = '';12 this.products = [];13}14BestBuy.prototype.createURL = function (searchTerm, minPrice, maxPrice, minScreenSize, maxScreenSize, minWeight, maxWeight, minMemory, maxMemory) {15};16BestBuy.prototype.getProducts = function (callback) {17 var self = this;18 request(self.url, function (error, response, body) {19 if (!error && response.statusCode == 200) {20 var $ = cheerio.load(body);21 var products = [];
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!