+
+ it('Should test webfinger', async function () {
+ const resource = 'acct:peertube@' + server.host
+ const accountUrl = server.url + '/accounts/peertube'
+
+ const res = await makeGetRequest({
+ url: server.url,
+ path: '/.well-known/webfinger?resource=' + resource,
+ expectedStatus: HttpStatusCode.OK_200
+ })
+
+ const data = res.body
+
+ expect(data.subject).to.equal(resource)
+ expect(data.aliases).to.contain(accountUrl)
+
+ const self = data.links.find(l => l.rel === 'self')
+ expect(self).to.exist
+ expect(self.type).to.equal('application/activity+json')
+ expect(self.href).to.equal(accountUrl)
+
+ const remoteInteract = data.links.find(l => l.rel === 'http://ostatus.org/schema/1.0/subscribe')
+ expect(remoteInteract).to.exist
+ expect(remoteInteract.template).to.equal(server.url + '/remote-interaction?uri={uri}')
+ })
+
+ it('Should return 404 for non-existing files in /.well-known', async function () {
+ await makeGetRequest({
+ url: server.url,
+ path: '/.well-known/non-existing-file',
+ expectedStatus: HttpStatusCode.NOT_FOUND_404
+ })
+ })
+
+ it('Should return custom file from /.well-known', async function () {
+ const filename = 'existing-file.json'
+
+ await writeJson(join(wellKnownPath, filename), { iThink: 'therefore I am' })
+
+ const { body } = await makeGetRequest({
+ url: server.url,
+ path: '/.well-known/' + filename,
+ expectedStatus: HttpStatusCode.OK_200
+ })
+
+ expect(body.iThink).to.equal('therefore I am')
+ })