diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2020-12-07 14:32:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-07 14:32:36 +0100 |
commit | 2d53be0267acc49cda46707b885096193a1f4e9c (patch) | |
tree | 887061a34bc67f40acbb96a6278f9544bf83caeb /server/tests/misc-endpoints.ts | |
parent | adc1f09c0dbd997f34028c1c82d1c118dc8ead80 (diff) | |
download | PeerTube-2d53be0267acc49cda46707b885096193a1f4e9c.tar.gz PeerTube-2d53be0267acc49cda46707b885096193a1f4e9c.tar.zst PeerTube-2d53be0267acc49cda46707b885096193a1f4e9c.zip |
replace numbers with typed http status codes (#3409)
Diffstat (limited to 'server/tests/misc-endpoints.ts')
-rw-r--r-- | server/tests/misc-endpoints.ts | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/server/tests/misc-endpoints.ts b/server/tests/misc-endpoints.ts index 3d0224323..698d83328 100644 --- a/server/tests/misc-endpoints.ts +++ b/server/tests/misc-endpoints.ts | |||
@@ -13,6 +13,7 @@ import { | |||
13 | uploadVideo | 13 | uploadVideo |
14 | } from '../../shared/extra-utils' | 14 | } from '../../shared/extra-utils' |
15 | import { VideoPrivacy } from '../../shared/models/videos' | 15 | import { VideoPrivacy } from '../../shared/models/videos' |
16 | import { HttpStatusCode } from '@shared/core-utils' | ||
16 | 17 | ||
17 | const expect = chai.expect | 18 | const expect = chai.expect |
18 | 19 | ||
@@ -32,7 +33,7 @@ describe('Test misc endpoints', function () { | |||
32 | const res = await makeGetRequest({ | 33 | const res = await makeGetRequest({ |
33 | url: server.url, | 34 | url: server.url, |
34 | path: '/.well-known/security.txt', | 35 | path: '/.well-known/security.txt', |
35 | statusCodeExpected: 200 | 36 | statusCodeExpected: HttpStatusCode.OK_200 |
36 | }) | 37 | }) |
37 | 38 | ||
38 | expect(res.text).to.contain('security issue') | 39 | expect(res.text).to.contain('security issue') |
@@ -42,7 +43,7 @@ describe('Test misc endpoints', function () { | |||
42 | const res = await makeGetRequest({ | 43 | const res = await makeGetRequest({ |
43 | url: server.url, | 44 | url: server.url, |
44 | path: '/.well-known/nodeinfo', | 45 | path: '/.well-known/nodeinfo', |
45 | statusCodeExpected: 200 | 46 | statusCodeExpected: HttpStatusCode.OK_200 |
46 | }) | 47 | }) |
47 | 48 | ||
48 | expect(res.body.links).to.be.an('array') | 49 | expect(res.body.links).to.be.an('array') |
@@ -54,7 +55,7 @@ describe('Test misc endpoints', function () { | |||
54 | const res = await makeGetRequest({ | 55 | const res = await makeGetRequest({ |
55 | url: server.url, | 56 | url: server.url, |
56 | path: '/.well-known/dnt-policy.txt', | 57 | path: '/.well-known/dnt-policy.txt', |
57 | statusCodeExpected: 200 | 58 | statusCodeExpected: HttpStatusCode.OK_200 |
58 | }) | 59 | }) |
59 | 60 | ||
60 | expect(res.text).to.contain('http://www.w3.org/TR/tracking-dnt') | 61 | expect(res.text).to.contain('http://www.w3.org/TR/tracking-dnt') |
@@ -64,7 +65,7 @@ describe('Test misc endpoints', function () { | |||
64 | const res = await makeGetRequest({ | 65 | const res = await makeGetRequest({ |
65 | url: server.url, | 66 | url: server.url, |
66 | path: '/.well-known/dnt', | 67 | path: '/.well-known/dnt', |
67 | statusCodeExpected: 200 | 68 | statusCodeExpected: HttpStatusCode.OK_200 |
68 | }) | 69 | }) |
69 | 70 | ||
70 | expect(res.body.tracking).to.equal('N') | 71 | expect(res.body.tracking).to.equal('N') |
@@ -74,7 +75,7 @@ describe('Test misc endpoints', function () { | |||
74 | const res = await makeGetRequest({ | 75 | const res = await makeGetRequest({ |
75 | url: server.url, | 76 | url: server.url, |
76 | path: '/.well-known/change-password', | 77 | path: '/.well-known/change-password', |
77 | statusCodeExpected: 302 | 78 | statusCodeExpected: HttpStatusCode.FOUND_302 |
78 | }) | 79 | }) |
79 | 80 | ||
80 | expect(res.header.location).to.equal('/my-account/settings') | 81 | expect(res.header.location).to.equal('/my-account/settings') |
@@ -87,7 +88,7 @@ describe('Test misc endpoints', function () { | |||
87 | const res = await makeGetRequest({ | 88 | const res = await makeGetRequest({ |
88 | url: server.url, | 89 | url: server.url, |
89 | path: '/robots.txt', | 90 | path: '/robots.txt', |
90 | statusCodeExpected: 200 | 91 | statusCodeExpected: HttpStatusCode.OK_200 |
91 | }) | 92 | }) |
92 | 93 | ||
93 | expect(res.text).to.contain('User-agent') | 94 | expect(res.text).to.contain('User-agent') |
@@ -97,7 +98,7 @@ describe('Test misc endpoints', function () { | |||
97 | await makeGetRequest({ | 98 | await makeGetRequest({ |
98 | url: server.url, | 99 | url: server.url, |
99 | path: '/security.txt', | 100 | path: '/security.txt', |
100 | statusCodeExpected: 301 | 101 | statusCodeExpected: HttpStatusCode.MOVED_PERMANENTLY_301 |
101 | }) | 102 | }) |
102 | }) | 103 | }) |
103 | 104 | ||
@@ -105,7 +106,7 @@ describe('Test misc endpoints', function () { | |||
105 | const res = await makeGetRequest({ | 106 | const res = await makeGetRequest({ |
106 | url: server.url, | 107 | url: server.url, |
107 | path: '/nodeinfo/2.0.json', | 108 | path: '/nodeinfo/2.0.json', |
108 | statusCodeExpected: 200 | 109 | statusCodeExpected: HttpStatusCode.OK_200 |
109 | }) | 110 | }) |
110 | 111 | ||
111 | expect(res.body.software.name).to.equal('peertube') | 112 | expect(res.body.software.name).to.equal('peertube') |
@@ -118,7 +119,7 @@ describe('Test misc endpoints', function () { | |||
118 | const res = await makeGetRequest({ | 119 | const res = await makeGetRequest({ |
119 | url: server.url, | 120 | url: server.url, |
120 | path: '/sitemap.xml', | 121 | path: '/sitemap.xml', |
121 | statusCodeExpected: 200 | 122 | statusCodeExpected: HttpStatusCode.OK_200 |
122 | }) | 123 | }) |
123 | 124 | ||
124 | expect(res.text).to.contain('xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"') | 125 | expect(res.text).to.contain('xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"') |
@@ -129,7 +130,7 @@ describe('Test misc endpoints', function () { | |||
129 | const res = await makeGetRequest({ | 130 | const res = await makeGetRequest({ |
130 | url: server.url, | 131 | url: server.url, |
131 | path: '/sitemap.xml', | 132 | path: '/sitemap.xml', |
132 | statusCodeExpected: 200 | 133 | statusCodeExpected: HttpStatusCode.OK_200 |
133 | }) | 134 | }) |
134 | 135 | ||
135 | expect(res.text).to.contain('xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"') | 136 | expect(res.text).to.contain('xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"') |
@@ -152,7 +153,7 @@ describe('Test misc endpoints', function () { | |||
152 | const res = await makeGetRequest({ | 153 | const res = await makeGetRequest({ |
153 | url: server.url, | 154 | url: server.url, |
154 | path: '/sitemap.xml?t=1', // avoid using cache | 155 | path: '/sitemap.xml?t=1', // avoid using cache |
155 | statusCodeExpected: 200 | 156 | statusCodeExpected: HttpStatusCode.OK_200 |
156 | }) | 157 | }) |
157 | 158 | ||
158 | expect(res.text).to.contain('xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"') | 159 | expect(res.text).to.contain('xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"') |