Skip to content
This repository has been archived by the owner on May 28, 2018. It is now read-only.

Commit

Permalink
Add tests on application update
Browse files Browse the repository at this point in the history
  • Loading branch information
nbrohee committed Jul 27, 2017
1 parent 8b0f5e4 commit 448686a
Showing 1 changed file with 127 additions and 0 deletions.
127 changes: 127 additions & 0 deletions server/api/application/test/application.api.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,133 @@ describe('api: application', () => {
})
})

describe('When updating an applicationd', () => {
before((done) => {
ApplicationModel.insertMany(applicationData, done)
})

after((done) => {
ApplicationModel.remove(done)
})

describe('When the application does not exist', () => {
it('should return a 404', (done) => {
supertest(app)
.put('/api/application/0edaaf484d50ad693d5abee4')
.expect(404, done)
})
})

describe('When the application is valid', () => {
const newApplication = {
'project': {
'name': '',
'summary': 'aze',
'type': 'retake',
'site': '',
'status': 'company',
'blog': '',
'facebook': '',
'twitter': '',
'siret': '',
'activitySummary': 'azeaze',
'stepSummary': 'azeaze',
'sector': '9',
'otherSector': '',
'motiviation': 'azeaze',
'linkedin': '',
'team': [],
'teamType': ''
},
'profile': {
'gender': 'male',
'situation': 'graduate',
'nationality': 'AW',
'motivation': 'azeaz',
'isPartTime': 'true',
'hasActivity': 'true',
'activity': '',
'isUnemployed': 'true',
'isFreelance': 'true',
'birthDate': '2016-11-08T11:00:00.000Z',
'birthPlace': 'azeaz',
'ine': '',
'address': 'aze',
'cp': 'aze',
'city': 'azeaz',
'country': 'AW',
'twitter': '',
'facebook': '',
'linkedin': '',
'viadeo': ''
},
'career': {
'bac': {
'isOriginal': 'true',
'type': 'general',
'country': 'AO',
'year': '2002',
'stream': '',
'establishment': '&é\'&é',
'city': '&é\'&é\''
},
'diploma': {
'year': '2004-2005',
'type': '5',
'name': 'azeaze',
'sector': '',
'establishment': 'azeaz',
'city': 'azea'
},
'tutor': {
'name': 'arzeaz',
'firstname': 'azeazeaz',
'email': 'aeaze@zaeeazaz.com',
'skill': 'azezaz',
'replaceInternship': 'true',
'replaceModule': 'true',
'askYearOff': 'true'
},
'entrepreneurship': []
},
'pepite': {
'region': '1',
'establishment': 0,
'pepite': '3',
'askCoworking': 'true'
},
'_id': '9c9d6a6b832effc406059b15',
'__v': 0,
'sentDate': '2016-11-24T11:12:12.329Z',
'status': 'saved',
'contact': {
'schoolYear': 2016,
'isRenew': 'true',
'situation': 'student',
'phone': '0643333333',
'email': 'test@test.com',
'firstname': 'William',
'name': 'Rimbeau'
},
'date': '2016-11-24T11:12:12.272Z'
}

it('should return a 200 with the updated application', (done) => {
supertest(app)
.put('/api/application/9c9d6a6b832effc406059b15')
.send(newApplication)
.expect(200)
.end((err, res) => {
if (err) {
return done(err)
}
expect(res.body).toContain(newApplication)
return done()
})
})
})
})

describe('When requesting /api/application/:id/certificate', () => {
let validToken = {}

Expand Down

0 comments on commit 448686a

Please sign in to comment.