Remember registered schemes.

This commit is contained in:
Cheng Zhao 2013-08-24 16:38:19 +08:00
parent b9cbfb8103
commit 96c173217f
3 changed files with 63 additions and 0 deletions

15
spec/api/protocol.coffee Normal file
View file

@ -0,0 +1,15 @@
assert = require 'assert'
protocol = require('remote').require 'protocol'
describe 'protocol API', ->
describe 'protocol.registerProtocol', ->
it 'throws error when scheme is already registered', ->
register = -> protocol.registerProtocol('test', ->)
register()
assert.throws register, /The scheme is already registered/
protocol.unregisterProtocol 'test'
describe 'protocol.unregisterProtocol', ->
it 'throws error when scheme does not exist', ->
unregister = -> protocol.unregisterProtocol 'test'
assert.throws unregister, /The scheme has not been registered/