Commit df09c8f2 authored by ujvari's avatar ujvari Committed by Randall Leeds

Add comments and fix tests

parent 11430695
###*
# @ngdoc service
# @name store
#
# @description
# The `store` service handles the backend calls for the restful API.
###
angular.module('h')
.service('store', [
'$document', '$http', '$resource',
($document, $http, $resource) ->
# Find any service link tag
svc = $document.find('link')
.filter -> @rel is 'service' and @type is 'application/annotatorsvc+json'
.filter -> @href
......@@ -9,10 +18,15 @@ angular.module('h')
store =
$resolved: false
# We call the service_url and the backend api gives back
# the actions and urls it provides.
$promise: $http.get(svc)
.finally -> store.$resolved = true
.then (response) ->
for name, actions of response.data.links
# For each action name we configure an ng-resource.
# For the search resource, one URL is given for all actions.
# For the annotations, each action has its own URL.
store[name] = $resource(actions.url or svc, {}, actions)
store
])
......@@ -5,7 +5,7 @@ ST_CLOSED = 3
###*
# @ngdoc service
# @name Streamer
# @name streamer
#
# @property {string} clientId A unique identifier for this client.
#
......
......@@ -97,6 +97,7 @@ describe 'streamer', ->
msg = fakeSock.send.getCall(0).args[0]
data = JSON.parse(msg)
assert.equal(data.messageType, 'client_id')
assert.equal(typeof data.value, 'string')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment