angularjs - Angular Karma post has unexpected JSON -


i have following karma test. error "expected: {"data":{"form_field_17":"none required","title":"mr","firstname":"john","lastname":"doe","email":"john@gmail.com","mobile":"1114269874","registration":"123","form_field_15":"test","pref_date":"2016-08-30t02:13:00.000z"},"formid":4} got: {"data":"{\"form_field_17\":\"none required\",\"title\":\"mr\",\"firstname\":\"john\",\"lastname\":\"doe\",\"email\":\"john@gmail.com\",\"mobile\":\"1114269874\",\"registration\":\"123\",\"form_field_15\":\"test\",\"pref_date\":\"30/08/2016 12:13 pm\"}","formid":4}

why json object have backslashes , pref_date has changed format?

describe('when submitting form', function () {         it('should successful', function () {             var d = {                 form_field_17: "none required",                 title: "mr",                 firstname: "john",                 lastname: "doe",                 email: "john@gmail.com",                 mobile: "1114269874",                 registration: "123",                 form_field_15: "test",                 pref_date: "2016-08-30t02:13:00.000z"             };              $httpbackend.expect('post', '/dynamicform/submitform/', { data: d, formid: 4})                 .respond(200, "[{ success : 'true', data : 'true' }]");              dynamicformfactory.submitform(d, 4)               .then(function (data) {                   expect(data.success).tobetruthy();               });              $httpbackend.flush();              $httpbackend.verifynooutstandingexpectation();             $httpbackend.verifynooutstandingrequest();         });     }); 


Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -