Stub Lightning Data Service response in Lightning Test Service (Jasmine)

Using Jasmine I can simply stub response as this before $T.createComponent:

  $A.enqueueAction = jasmine.createSpy().and.callFake((action) => {
    var cb = action.getCallback("SUCCESS")
    cb.fn.apply(cb.s, [{
      getState: function() {
        return "SUCCESS";
      },
      getReturnValue: function() {
        return [{
          "Name": "Edge Communications",
          "Id": "0010q00000000000A2"
        }, {
          "Name": "Burlington Textiles Corp of America",
          "Id": "0010q00000000000A3"
        }]
      }
    }]);
  });

How can I do the same with Lightning Data Service?

Answer

Attribution
Source : Link , Question Author : dzh , Answer Author : Community

Leave a Comment