                 email      :  'Plese sign up and join this project.'
                 title      :  'Team Project'
                 link2proj  :  "#{base_url}/projects/#{project_id}"
-            cb    :  ->
-                #expect(resp?.event).toBe('invite_noncloud_collaborators_resp')
-                #expect(api.last_email?.subject).toBe('CoCalc Invitation')
-                done()
+            cb    :  (err, resp) ->
+                check = (err, resp) ->
+                    opts0 = email.send_email.args[0][0]
+                    expect(resp?.event).toBe('invite_noncloud_collaborators_resp')
+                    expect(opts0?.subject).toBe('CoCalc Invitation')
+                    done()
+                # sending email is probably async, wait a bit
+                setTimeout((-> check(err, resp)), 100)
 
 
     it "removes collaborator", (done) ->

                done(err)

    project_id2 = undefined
    it "inivtes a collaborator to a project with an email message", (done) ->
        # create new account and then invite
        async.series([
            (cb) ->

                        setTimeout((-> cb(err)), 100)

        ], (err) ->
            expect(err).toBe('')
            expect(err?).toBe(false)
            opts0 = email.send_email.args[0][0]
            expect(opts0.subject).toBe('SUBJECT_OF_EMAIL_1')
            expect(opts0.from).toBe('cocalc+3@sagemath.com')
            expect(opts0.fromname).toBe('Sage3 CoCalc3')
            expect(opts0.body.indexOf('BODY_OF_EMAIL_1') > 0).toBe(true)
            # no second email
            winston.info("email.send_email.args: #{misc.to_json(email.send_email.args)}")
