All files / lib/providers index.js

54.55% Statements 6/11
50% Branches 1/2
20% Functions 1/5
54.55% Lines 6/11

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31  1x 1x                           3x 3x             3x     1x      
"use strict";
const { awsCreate, awsDestroy, awsListInstances } = require("./aws");
const methods = {
  aws: {
    create: awsCreate,
    destroy: awsDestroy,
    list: awsListInstances,
    increase: ()=>{},
    decrease: ()=>{},
    suspend: ()=>{},
    resume: ()=>{}
  }
};
 
 
function getMethod(provider, cmd) {
  const method = methods[provider][cmd];
  Iif (typeof method !== "function") {
    const err = new Error("Method not found");
    err.message = `can not found ${cmd} method for ${provider}`;
    err.provider = provider;
    err.cmd = cmd;
    throw err;
  }
  return method;
}
 
module.exports = {
  getMethod
};