text: 'use strict';var cov_rpfvukl6b=function(){var path="C:\\Users\\Angel Barusta\\Desktop\\nodejs\\iot_nodejs\\lib\\agent.js",hash="56a0313b7f6b3214d68d5869aa7e9eb64e3ff212",Function=function(){}.constructor,global=new Function('return this')(),gcv="__coverage__",coverageData={path:"C:\\Users\\Angel Barusta\\Desktop\\nodejs\\iot_nodejs\\lib\\agent.js",statementMap:{"0":{start:{line:3,column:0},end:{line:65,column:1}},"1":{start:{line:5,column:17},end:{line:9,column:5}},"2":{start:{line:11,column:26},end:{line:11,column:56}},"3":{start:{line:13,column:4},end:{line:16,column:5}},"4":{start:{line:14,column:22},end:{line:14,column:58}},"5":{start:{line:15,column:6},end:{line:15,column:63}},"6":{start:{line:18,column:19},end:{line:18,column:49}},"7":{start:{line:19,column:4},end:{line:19,column:26}},"8":{start:{line:23,column:4},end:{line:23,column:34}},"9":{start:{line:27,column:4},end:{line:31,column:6}},"10":{start:{line:35,column:4},end:{line:35,column:31}},"11":{start:{line:39,column:4},end:{line:43,column:6}},"12":{start:{line:48,column:4},end:{line:53,column:6}},"13":{start:{line:57,column:2},end:{line:64,column:3}}},fnMap:{"0":{name:"setupAgent",decl:{start:{line:3,column:26},end:{line:3,column:36}},loc:{start:{line:3,column:50},end:{line:65,column:1}},line:3},"1":{name:"createOrUpdate",decl:{start:{line:4,column:17},end:{line:4,column:31}},loc:{start:{line:4,column:40},end:{line:20,column:3}},line:4},"2":{name:"findById",decl:{start:{line:22,column:11},end:{line:22,column:19}},loc:{start:{line:22,column:25},end:{line:24,column:3}},line:22},"3":{name:"findByUuid",decl:{start:{line:26,column:11},end:{line:26,column:21}},loc:{start:{line:26,column:29},end:{line:32,column:3}},line:26},"4":{name:"findAll",decl:{start:{line:34,column:11},end:{line:34,column:18}},loc:{start:{line:34,column:22},end:{line:36,column:3}},line:34},"5":{name:"findConnected",decl:{start:{line:38,column:11},end:{line:38,column:24}},loc:{start:{line:38,column:28},end:{line:44,column:3}},line:38},"6":{name:"findByUsername",decl:{start:{line:47,column:11},end:{line:47,column:25}},loc:{start:{line:47,column:37},end:{line:54,column:3}},line:47}},branchMap:{"0":{loc:{start:{line:13,column:4},end:{line:16,column:5}},type:"if",locations:[{start:{line:13,column:4},end:{line:16,column:5}},{start:{line:13,column:4},end:{line:16,column:5}}],line:13},"1":{loc:{start:{line:15,column:13},end:{line:15,column:63}},type:"cond-expr",locations:[{start:{line:15,column:23},end:{line:15,column:47}},{start:{line:15,column:50},end:{line:15,column:63}}],line:15}},s:{"0":0,"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0},f:{"0":0,"1":0,"2":0,"3":0,"4":0,"5":0,"6":0},b:{"0":[0,0],"1":[0,0]},_coverageSchema:"43e27e138ebf9cfc5966b082cf9a028302ed4184"},coverage=global[gcv]||(global[gcv]={});if(coverage[path]&&coverage[path].hash===hash){return coverage[path];}coverageData.hash=hash;return coverage[path]=coverageData;}();cov_rpfvukl6b.s[0]++;module.exports=function setupAgent(AgentModel){cov_rpfvukl6b.f[0]++;async function createOrUpdate(agent){cov_rpfvukl6b.f[1]++;const cond=(cov_rpfvukl6b.s[1]++,{where:{uuid:agent.uuid}});const existingAgent=(cov_rpfvukl6b.s[2]++,await AgentModel.findOne(cond));// findOne retorna la primeera ocurrencia que cumpla con la condicion que acaba de pasar
  cov_rpfvukl6b.s[3]++;if(existingAgent){cov_rpfvukl6b.b[0][0]++;const updated=(cov_rpfvukl6b.s[4]++,await AgentModel.update(agent,cond));cov_rpfvukl6b.s[5]++;return updated?(cov_rpfvukl6b.b[1][0]++,AgentModel.findOne(cond)):(cov_rpfvukl6b.b[1][1]++,existingAgent);}else{cov_rpfvukl6b.b[0][1]++;}const result=(cov_rpfvukl6b.s[6]++,await AgentModel.create(agent));cov_rpfvukl6b.s[7]++;return result.toJSON();}// ------------------------------------------------------------------
  function findById(id){cov_rpfvukl6b.f[2]++;cov_rpfvukl6b.s[8]++;return AgentModel.findById(id);// si se modifica el 'id' por x motivo la prueba fallara
  }// --------------------------------------------------------------
  function findByUuid(uuid){cov_rpfvukl6b.f[3]++;cov_rpfvukl6b.s[9]++;return AgentModel.findOne({where:{uuid}});}// ------------------------------------------------------------
  function findAll(){cov_rpfvukl6b.f[4]++;cov_rpfvukl6b.s[10]++;return AgentModel.findAll();}// --------------------------------------------------
  function findConnected(){cov_rpfvukl6b.f[5]++;cov_rpfvukl6b.s[11]++;return AgentModel.findAll({where:{connected:true}});}// ---------------------------------------------------------
  function findByUsername(username){cov_rpfvukl6b.f[6]++;cov_rpfvukl6b.s[12]++;return AgentModel.findAll({where:{username,connected:true}});}// --------------------------------------------------------
  cov_rpfvukl6b.s[13]++;return{createOrUpdate,findById,findByUuid,findAll,findConnected,findByUsername};};