Permalink
Browse files

added first simple test

  • Loading branch information...
1 parent bdcbcde commit 92219e7fb2715e0b02effeda3b699fd9f9b4dbba @flosse committed Feb 26, 2012
Showing with 30 additions and 0 deletions.
  1. +30 −0 spec/node-xmpp-serviceadmin.spec.coffee
@@ -0,0 +1,30 @@
+sa = require "node-xmpp-serviceadmin"
+ltx = require "ltx"
+
+describe "Service Admin", ->
+
+ service = "comp.exmaple.tld"
+
+ xmppClient =
+ send: (data) -> xmppComp.channels.stanza data
+ onData: (data, cb) ->
+
+ xmppComp =
+ channels: {}
+ send: (data) -> xmppClient.onData data
+ onData: (data) ->
+ on: (channel, cb) ->
+ @channels[channel] = cb
+ jid: service
+
+ it "creates a new ServiceAdmin object", ->
+
+ # define the JID that has the admin privileges
+ root = "root@#{service}"
+ serviceAdmin = new sa.ServiceAdmin root, xmppComp, service
+ (expect typeof serviceAdmin).toEqual "object"
+ (expect serviceAdmin.jid).toEqual root
+ (expect serviceAdmin.service).toEqual service
+ (expect typeof serviceAdmin.addUser).toEqual "function"
+ (expect typeof serviceAdmin.deleteUser).toEqual "function"
+ (expect typeof serviceAdmin.changeUserPassword).toEqual "function"

0 comments on commit 92219e7

Please sign in to comment.