it('Should fail without hosts', async function () {
await request(server.url)
- .post(path + '/makefriends')
+ .post(path + '/make-friends')
.set('Authorization', 'Bearer ' + server.accessToken)
.set('Accept', 'application/json')
.expect(400)
it('Should fail if hosts is not an array', async function () {
await request(server.url)
- .post(path + '/makefriends')
+ .post(path + '/make-friends')
.send({ hosts: 'localhost:9002' })
.set('Authorization', 'Bearer ' + server.accessToken)
.set('Accept', 'application/json')
it('Should fail if the array is not composed by hosts', async function () {
await request(server.url)
- .post(path + '/makefriends')
+ .post(path + '/make-friends')
.send({ hosts: [ 'localhost:9002', 'localhost:coucou' ] })
.set('Authorization', 'Bearer ' + server.accessToken)
.set('Accept', 'application/json')
it('Should fail if the array is composed with http schemes', async function () {
await request(server.url)
- .post(path + '/makefriends')
+ .post(path + '/make-friends')
.send({ hosts: [ 'localhost:9002', 'http://localhost:9003' ] })
.set('Authorization', 'Bearer ' + server.accessToken)
.set('Accept', 'application/json')
it('Should fail if hosts are not unique', async function () {
await request(server.url)
- .post(path + '/makefriends')
+ .post(path + '/make-friends')
.send({ urls: [ 'localhost:9002', 'localhost:9002' ] })
.set('Authorization', 'Bearer ' + server.accessToken)
.set('Accept', 'application/json')
it('Should fail with an invalid token', async function () {
await request(server.url)
- .post(path + '/makefriends')
+ .post(path + '/make-friends')
.send(body)
- .set('Authorization', 'Bearer faketoken')
+ .set('Authorization', 'Bearer fake_token')
.set('Accept', 'application/json')
.expect(401)
})
it('Should fail if the user is not an administrator', async function () {
await request(server.url)
- .post(path + '/makefriends')
+ .post(path + '/make-friends')
.send(body)
.set('Authorization', 'Bearer ' + userAccessToken)
.set('Accept', 'application/json')
describe('When quitting friends', function () {
it('Should fail with an invalid token', async function () {
await request(server.url)
- .get(path + '/quitfriends')
+ .get(path + '/quit-friends')
.query({ start: 'hello' })
.set('Authorization', 'Bearer faketoken')
.set('Accept', 'application/json')
it('Should fail if the user is not an administrator', async function () {
await request(server.url)
- .get(path + '/quitfriends')
+ .get(path + '/quit-friends')
.query({ start: 'hello' })
.set('Authorization', 'Bearer ' + userAccessToken)
.set('Accept', 'application/json')