             allowedDomains : [ 'koding.com' ]
 
           # create the group
-          JGroup.create adminClient, groupData, account, (err, data)->
+          JGroup.create adminClient, groupData, account, (err, data) ->
             expect(err).to.not.exist
 
             group = data

    describe 'if user is not a member yet', ->

      it 'should receive the invitation', (done) ->

        invitationReq = {
          invitations:[
            { email: userFormData.email }
          ]
        }

        JInvitation.create adminClient, invitationReq, (err)->
          expect(err).to.not.exist

          JInvitation.one { email: userFormData.email, groupName: client.context.group }, (err, invitation)->
            expect(err).to.not.exist
            expect(invitation).to.exist

            done()


    describe 'if user is already member', ->

      it 'should not receive the invitation', (done) ->

        JUser.convert client, userFormData, (err) ->
          expect(err).to.not.exist

          invitationReq = {
            invitations:[
              { email: userFormData.email }
            ]
          }

          JInvitation.create adminClient, invitationReq, (err)->
            expect(err).to.not.exist

            JInvitation.one { email: userFormData.email, groupName: group.slug }, (err, invitation)->
              expect(err).to.not.exist
              expect(invitation).to.not.exist

              done()


runTests()

KONFIG                      = require('koding-config-manager').load("main.#{argv.c}")
mongo                       = MONGO_URL or "mongodb://#{ KONFIG.mongo }"
Bongo                       = require 'bongo'
{ daisy }                   = Bongo
JUser                       = require './user'
JGroup                      = require './group'
JAccount                    = require './account'
