I have the following method to load a JSON file using coffeescript/jquery:
Class JsonParser
this.return = (json_file_path, string_to_query) ->
$.getJSON json_file_path, (data) ->
$.each data, (key,val) ->
if key == string_to_query
return val
And I am Testing it in Jasmine with:
expect(JsonParser.return("file.json", "key").toEqual("value")
But what Jasmine spits out instead is:
Expected { readyState : 1, getResponseHeader : Function, getAllResponseHeaders
: Function, setRequestHeader : Function, overrideMimeType : Function, statusCode : Function, abort :
Function, state : Function, always : Function, then : Function, promise : Function, pipe : Function, d
one : Function, fail : Function, progress : Function, complete : Function, success : Function, error :
Function } to equal 'value'.
Assume the JSON file has only one line: { "key": "value" }
I am just getting my feet wet with jquery/coffeescript/ajax etc. and don't understand Jasmines response. Let me know if further information is needed thanks!.