protocol: adding error job to log error with custom protocols

This commit is contained in:
deepak1556 2015-05-07 13:12:35 +05:30
parent e5380fd671
commit 9ab53b0e4b
5 changed files with 49 additions and 2 deletions

View file

@ -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)