codecombat/spec/server/functional/contact.spec.coffee
Scott Erickson f0fa88206d Add Enrollment start/end dates, remove self-serve
* Refactor several related endpoints and views
* Redesign EnrollmentView, add TeacherContactModal
* Add "Enrollment Status" tab to TeacherClassView
* Delete PurchaseCoursesView and related files
* Style-flatten RemoveStudentModal
* Fix error handling in ActivateLicensesModal
* TeacherCoursesView loads faster by only loading course campaigns, and not load prepaids
2016-05-24 14:07:28 -07:00

25 lines
901 B
CoffeeScript

utils = require '../utils'
sendwithus = require '../../../server/sendwithus'
request = require '../request'
User = require '../../../server/models/User'
describe 'POST /contact', ->
beforeEach utils.wrap (done) ->
spyOn(sendwithus.api, 'send')
@teacher = yield utils.initUser({role: 'teacher'})
yield utils.loginUser(@teacher)
done()
describe 'when recipientID is "schools@codecombat.com"', ->
it 'sends to that email', utils.wrap (done) ->
[res, body] = yield request.postAsync({url: getURL('/contact'), json: {
sender: 'some@email.com'
message: 'A message'
recipientID: 'schools@codecombat.com'
}})
expect(sendwithus.api.send).toHaveBeenCalled()
user = yield User.findById(@teacher.id)
yield new Promise((resolve) -> setTimeout(resolve, 10))
expect(user.get('enrollmentRequestSent')).toBe(true)
done()