1 /* tslint:disable:no-unused-expression */
4 import * as chai from 'chai'
5 import { flushTests, killallServers, makeGetRequest, runServer, ServerInfo } from './utils'
7 const expect = chai.expect
9 describe('Test misc endpoints', function () {
10 let server: ServerInfo
12 before(async function () {
17 server = await runServer(1)
20 describe('Test a well known endpoints', function () {
22 it('Should get security.txt', async function () {
23 const res = await makeGetRequest({
25 path: '/.well-known/security.txt',
26 statusCodeExpected: 200
29 expect(res.text).to.contain('security issue')
32 it('Should get nodeinfo', async function () {
33 const res = await makeGetRequest({
35 path: '/.well-known/nodeinfo',
36 statusCodeExpected: 200
39 expect(res.body.links).to.be.an('array')
40 expect(res.body.links).to.have.lengthOf(1)
41 expect(res.body.links[0].rel).to.equal('http://nodeinfo.diaspora.software/ns/schema/2.0')
44 it('Should get dnt policy text', async function () {
45 const res = await makeGetRequest({
47 path: '/.well-known/dnt-policy.txt',
48 statusCodeExpected: 200
51 expect(res.text).to.contain('http://www.w3.org/TR/tracking-dnt')
54 it('Should get dnt policy', async function () {
55 const res = await makeGetRequest({
57 path: '/.well-known/dnt',
58 statusCodeExpected: 200
61 expect(res.body.tracking).to.equal('N')
65 describe('Test classic static endpoints', function () {
67 it('Should get robots.txt', async function () {
68 const res = await makeGetRequest({
71 statusCodeExpected: 200
74 expect(res.text).to.contain('User-agent')
77 it('Should get security.txt', async function () {
78 await makeGetRequest({
80 path: '/security.txt',
81 statusCodeExpected: 301
85 it('Should get nodeinfo', async function () {
86 const res = await makeGetRequest({
88 path: '/nodeinfo/2.0.json',
89 statusCodeExpected: 200
92 expect(res.body.software.name).to.equal('peertube')
96 after(async function () {
97 killallServers([ server ])