|
@@ -58,6 +58,21 @@ describe 'protocol module', ->
|
|
|
assert false, 'Got error: ' + errorType + ' ' + error
|
|
|
protocol.unregisterProtocol 'atom-string-job'
|
|
|
|
|
|
+ it 'returns RequestErrorJob should send error', (done) ->
|
|
|
+ data = 'valar morghulis'
|
|
|
+ job = new protocol.RequestErrorJob(-6)
|
|
|
+ handler = remote.createFunctionWithReturnValue job
|
|
|
+ protocol.registerProtocol 'atom-error-job', handler
|
|
|
+
|
|
|
+ $.ajax
|
|
|
+ url: 'atom-error-job://fake-host'
|
|
|
+ success: (response) ->
|
|
|
+ assert false, 'should not reach here'
|
|
|
+ error: (xhr, errorType, error) ->
|
|
|
+ assert errorType, 'error'
|
|
|
+ protocol.unregisterProtocol 'atom-error-job'
|
|
|
+ done()
|
|
|
+
|
|
|
it 'returns RequestBufferJob should send buffer', (done) ->
|
|
|
data = new Buffer("hello")
|
|
|
job = new protocol.RequestBufferJob(data: data)
|