vendredi 30 octobre 2015

AngularJS unit testing service method return promise

I have service which make call to server, in that service i have one method which perform CRUD operations. I want to test my service. I stuck at testing all CRUD criteria i.e add, update ,delete etc.

my method in service:-

getPromiseForCRUDOperation(masterRecord : masterDefinitionEntity.MasterRecord, request : masterDefinitionEntity.MasterRequest) {
  return this.$http.post(config.Configs.getServerUrl() + "/masterRecord/" + request.type, masterRecord);
}

here request.type is enum for CRUD operations.(0-ADD,1-UPDATE and so on)

Aucun commentaire:

Enregistrer un commentaire