title: How do we mock private method using jasmine?
body: <p>Trying to mock private method that is in the class could not get any success, I am using jasmine so in below code i have <code>getDrug</code> method that is making http call , Now i can mock core but how do i stub/mock getDrug so code coverage can be improve.</p>
  
  <p>DrugPriceApi.node.ts</p>
  
  <pre><code>export class DrugPriceApi extends Types.ModuleBase &lt; DrugPriceParam, DrugPriceResultSet[] &gt; {
  
          private _memberId: string = "";
          private _dependencies: any;
          private errorMessage: string = "There was an issue while retrieving drug price. Please try again.";
  
          before(args: DrugPriceParam): Promise &lt; DrugPriceParam &gt; {
              args.daysSupply = args.daysSupply ? args.daysSupply : args.appName === "VOYA" ? "90" : "BLNK";
              return Promise.resolve(args);
          }
  
          core(args: DrugPriceParam, requestMethod: Interface.Core.RequestMethod, _dependencies: any): Promise &lt; any &gt; {
                  this._dependencies = _dependencies;
  
                  return new Promise &lt; any &gt; ((resolve: Function, reject: Function) =&gt; {
                          this.getDrug(function(resolve) {
                                  resolve( //response here);});
                                  }
                              }
  
                          }
                      }
                  }
  
                  private getDrug(args: DrugPriceParam, requestMethod: Interface.Core.RequestMethod) {
                      return requestMethod.http.makeRequest({
                          url: {
                              name: 'domain_getDrug',
                              params: {
                                  version: '1.0',
                                  appName: args.appName ? args.appName : 'WEB',
                                  tokenId: args.tokenId,
                                  refId: args.refId,
                                  internalID: args.memberInfo.internalID,
                                  searchText: args.drugName,
                                  drugNdcId: 'BLNK'
                              }
                          },
                          body: {
                              memberInfo: args.memberInfo
                          }
                      });
                  }
  </code></pre>
  
  <p>DrugPriceApi.spec.ts</p>
  
  <pre><code>       import {
              DrugPriceApi
          } from "./DrugPriceApi.node";
  
          it("should get drugByName", function(done) {
              let getDrug: any;
              beforeEach((done) =&gt; {
                  function getMockData(url: string): Promise &lt; any &gt; {
                      const rtnval = {
                          "details": [],
                          "header": {
                              "statusDesc": "Success",
                              "statusCode": "0000",
                              "IndexOfRequestThatFailed": []
                          }
                      };
  
                      return Promise.resolve(rtnval);
                  }
  
                  let moderator: Interface.Mock.Handler = {
                      getMockData: getMockData
                  };
                  getDrug = moderator;
  
              });
              let param: any;
              param.daysSupply = "BLNK";
              param.quantity = "BLNK";
              param.memberId = "1372";
              const result: any = _sdkInstance.SDK.Pricing.getDrugPrice(param);
              result.then(function(res: any) {
                  spyOn(DrugPriceApi.prototype, "core").and.callFake(() =&gt; {
                          expect(DrugPriceApi.prototype.getDrug).toHaveBeenCalled();
                  });
                  expect(res.Header.StatusCode).toBe("5000");
                  done();
              });
          });
  </code></pre>