aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests')
-rw-r--r--server/tests/api/check-params/pods.ts20
-rw-r--r--server/tests/utils/pods.ts4
2 files changed, 12 insertions, 12 deletions
diff --git a/server/tests/api/check-params/pods.ts b/server/tests/api/check-params/pods.ts
index 27c080931..a897e4dcd 100644
--- a/server/tests/api/check-params/pods.ts
+++ b/server/tests/api/check-params/pods.ts
@@ -49,7 +49,7 @@ describe('Test pods API validators', function () {
49 49
50 it('Should fail without hosts', async function () { 50 it('Should fail without hosts', async function () {
51 await request(server.url) 51 await request(server.url)
52 .post(path + '/makefriends') 52 .post(path + '/make-friends')
53 .set('Authorization', 'Bearer ' + server.accessToken) 53 .set('Authorization', 'Bearer ' + server.accessToken)
54 .set('Accept', 'application/json') 54 .set('Accept', 'application/json')
55 .expect(400) 55 .expect(400)
@@ -57,7 +57,7 @@ describe('Test pods API validators', function () {
57 57
58 it('Should fail if hosts is not an array', async function () { 58 it('Should fail if hosts is not an array', async function () {
59 await request(server.url) 59 await request(server.url)
60 .post(path + '/makefriends') 60 .post(path + '/make-friends')
61 .send({ hosts: 'localhost:9002' }) 61 .send({ hosts: 'localhost:9002' })
62 .set('Authorization', 'Bearer ' + server.accessToken) 62 .set('Authorization', 'Bearer ' + server.accessToken)
63 .set('Accept', 'application/json') 63 .set('Accept', 'application/json')
@@ -66,7 +66,7 @@ describe('Test pods API validators', function () {
66 66
67 it('Should fail if the array is not composed by hosts', async function () { 67 it('Should fail if the array is not composed by hosts', async function () {
68 await request(server.url) 68 await request(server.url)
69 .post(path + '/makefriends') 69 .post(path + '/make-friends')
70 .send({ hosts: [ 'localhost:9002', 'localhost:coucou' ] }) 70 .send({ hosts: [ 'localhost:9002', 'localhost:coucou' ] })
71 .set('Authorization', 'Bearer ' + server.accessToken) 71 .set('Authorization', 'Bearer ' + server.accessToken)
72 .set('Accept', 'application/json') 72 .set('Accept', 'application/json')
@@ -75,7 +75,7 @@ describe('Test pods API validators', function () {
75 75
76 it('Should fail if the array is composed with http schemes', async function () { 76 it('Should fail if the array is composed with http schemes', async function () {
77 await request(server.url) 77 await request(server.url)
78 .post(path + '/makefriends') 78 .post(path + '/make-friends')
79 .send({ hosts: [ 'localhost:9002', 'http://localhost:9003' ] }) 79 .send({ hosts: [ 'localhost:9002', 'http://localhost:9003' ] })
80 .set('Authorization', 'Bearer ' + server.accessToken) 80 .set('Authorization', 'Bearer ' + server.accessToken)
81 .set('Accept', 'application/json') 81 .set('Accept', 'application/json')
@@ -84,7 +84,7 @@ describe('Test pods API validators', function () {
84 84
85 it('Should fail if hosts are not unique', async function () { 85 it('Should fail if hosts are not unique', async function () {
86 await request(server.url) 86 await request(server.url)
87 .post(path + '/makefriends') 87 .post(path + '/make-friends')
88 .send({ urls: [ 'localhost:9002', 'localhost:9002' ] }) 88 .send({ urls: [ 'localhost:9002', 'localhost:9002' ] })
89 .set('Authorization', 'Bearer ' + server.accessToken) 89 .set('Authorization', 'Bearer ' + server.accessToken)
90 .set('Accept', 'application/json') 90 .set('Accept', 'application/json')
@@ -93,16 +93,16 @@ describe('Test pods API validators', function () {
93 93
94 it('Should fail with an invalid token', async function () { 94 it('Should fail with an invalid token', async function () {
95 await request(server.url) 95 await request(server.url)
96 .post(path + '/makefriends') 96 .post(path + '/make-friends')
97 .send(body) 97 .send(body)
98 .set('Authorization', 'Bearer faketoken') 98 .set('Authorization', 'Bearer fake_token')
99 .set('Accept', 'application/json') 99 .set('Accept', 'application/json')
100 .expect(401) 100 .expect(401)
101 }) 101 })
102 102
103 it('Should fail if the user is not an administrator', async function () { 103 it('Should fail if the user is not an administrator', async function () {
104 await request(server.url) 104 await request(server.url)
105 .post(path + '/makefriends') 105 .post(path + '/make-friends')
106 .send(body) 106 .send(body)
107 .set('Authorization', 'Bearer ' + userAccessToken) 107 .set('Authorization', 'Bearer ' + userAccessToken)
108 .set('Accept', 'application/json') 108 .set('Accept', 'application/json')
@@ -113,7 +113,7 @@ describe('Test pods API validators', function () {
113 describe('When quitting friends', function () { 113 describe('When quitting friends', function () {
114 it('Should fail with an invalid token', async function () { 114 it('Should fail with an invalid token', async function () {
115 await request(server.url) 115 await request(server.url)
116 .get(path + '/quitfriends') 116 .get(path + '/quit-friends')
117 .query({ start: 'hello' }) 117 .query({ start: 'hello' })
118 .set('Authorization', 'Bearer faketoken') 118 .set('Authorization', 'Bearer faketoken')
119 .set('Accept', 'application/json') 119 .set('Accept', 'application/json')
@@ -122,7 +122,7 @@ describe('Test pods API validators', function () {
122 122
123 it('Should fail if the user is not an administrator', async function () { 123 it('Should fail if the user is not an administrator', async function () {
124 await request(server.url) 124 await request(server.url)
125 .get(path + '/quitfriends') 125 .get(path + '/quit-friends')
126 .query({ start: 'hello' }) 126 .query({ start: 'hello' })
127 .set('Authorization', 'Bearer ' + userAccessToken) 127 .set('Authorization', 'Bearer ' + userAccessToken)
128 .set('Accept', 'application/json') 128 .set('Accept', 'application/json')
diff --git a/server/tests/utils/pods.ts b/server/tests/utils/pods.ts
index 0bea6db97..a86dd20d9 100644
--- a/server/tests/utils/pods.ts
+++ b/server/tests/utils/pods.ts
@@ -37,7 +37,7 @@ async function makeFriends (url: string, accessToken: string, expectedStatus = 2
37 'localhost:9003' 37 'localhost:9003'
38 ] 38 ]
39 } 39 }
40 const path = '/api/v1/pods/makefriends' 40 const path = '/api/v1/pods/make-friends'
41 41
42 // The first pod make friend with the third 42 // The first pod make friend with the third
43 const res = await request(url) 43 const res = await request(url)
@@ -54,7 +54,7 @@ async function makeFriends (url: string, accessToken: string, expectedStatus = 2
54} 54}
55 55
56async function quitFriends (url: string, accessToken: string, expectedStatus = 204) { 56async function quitFriends (url: string, accessToken: string, expectedStatus = 204) {
57 const path = '/api/v1/pods/quitfriends' 57 const path = '/api/v1/pods/quit-friends'
58 58
59 // The first pod make friend with the third 59 // The first pod make friend with the third
60 const res = await request(url) 60 const res = await request(url)