Commit 04761d7d authored by csillag's avatar csillag

Clean up some tests

parent e009194e
...@@ -42,6 +42,8 @@ describe 'h', -> ...@@ -42,6 +42,8 @@ describe 'h', ->
fakeThreading = fakeThreading =
idTable: {} idTable: {}
register: (annotation) ->
@idTable[annotation.id] = message: annotation
$provide.value 'identity', fakeIdentity $provide.value 'identity', fakeIdentity
$provide.value 'streamer', fakeStreamer $provide.value 'streamer', fakeStreamer
...@@ -101,25 +103,24 @@ describe 'h', -> ...@@ -101,25 +103,24 @@ describe 'h', ->
createController() createController()
$scope.$emit = sinon.spy() $scope.$emit = sinon.spy()
# Prepare the annotation that will come "from the wire"
anns = [
id: "fakeId"
data: "remote data"
]
# Prepare the annotation that we have locally # Prepare the annotation that we have locally
localAnnotation = localAnnotation =
id: "fake it" id: "fake ID"
data: "local data" data: "local data"
# Put our annotation into the threading id table # Introduce our annotation into threading
fakeThreading.idTable.fakeId = message: localAnnotation fakeThreading.register localAnnotation
# Prepare the annotation that will come "from the wire"
remoteAnnotation =
id: localAnnotation.id # same id as locally
data: "remote data" # different data
# Simulate a delete action # Simulate a delete action
fakeStreamer.onmessage fakeStreamer.onmessage
type: "annotation-notification" type: "annotation-notification"
options: action: "delete" options: action: "delete"
payload: anns payload: [ remoteAnnotation ]
assert.calledWith $scope.$emit, "annotationDeleted", localAnnotation assert.calledWith $scope.$emit, "annotationDeleted", localAnnotation
......
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