aboutsummaryrefslogtreecommitdiff
path: root/vnext/server/middleware
diff options
context:
space:
mode:
Diffstat (limited to 'vnext/server/middleware')
-rw-r--r--vnext/server/middleware/android.spec.js12
-rw-r--r--vnext/server/middleware/mastodon.spec.js8
-rw-r--r--vnext/server/middleware/webfinger.spec.js11
3 files changed, 10 insertions, 21 deletions
diff --git a/vnext/server/middleware/android.spec.js b/vnext/server/middleware/android.spec.js
index 448714ac..19d380d7 100644
--- a/vnext/server/middleware/android.spec.js
+++ b/vnext/server/middleware/android.spec.js
@@ -1,15 +1,11 @@
import request from 'supertest'
-import express from 'express'
-import releases from './android'
-
-const app = express()
-app.get('/releases', releases)
+import { app } from '../app'
describe('Releases helper', () => {
it('Should respond with empty array to unknown user agents', async () => {
return request(app)
- .get('/releases')
+ .get('/api/apps/android/releases')
.expect(200)
.then(response => {
expect(response.body).toStrictEqual([])
@@ -17,7 +13,7 @@ describe('Releases helper', () => {
})
it('Should respond with a single legacy version data to old Android app', async () => {
return request(app)
- .get('/releases')
+ .get('/api/apps/android/releases')
.set('User-Agent', 'Juick/100 okhttp/3.12 Android/19')
.expect(200)
.then(response => {
@@ -27,7 +23,7 @@ describe('Releases helper', () => {
})
it('Should redirect to Github when Android version is ok', async () => {
return request(app)
- .get('/releases')
+ .get('/api/apps/android/releases')
.set('User-Agent', 'Juick/100 okhttp/3.12 Android/24')
.expect(302)
.then(response => {
diff --git a/vnext/server/middleware/mastodon.spec.js b/vnext/server/middleware/mastodon.spec.js
index 648923e4..561303bc 100644
--- a/vnext/server/middleware/mastodon.spec.js
+++ b/vnext/server/middleware/mastodon.spec.js
@@ -1,14 +1,10 @@
import request from 'supertest'
-import express from 'express'
-import { instance } from './mastodon'
-
-const app = express()
-app.get('/instance', instance)
+import { app } from '../app'
describe('Mastodon API middleware', () => {
it('Inactive users should not be included in Instance response', async () => {
return request(app)
- .get('/instance')
+ .get('/api/v2/instance')
.expect(200)
.then(response => {
expect(response.body.usage.users.active_month).toStrictEqual(1)
diff --git a/vnext/server/middleware/webfinger.spec.js b/vnext/server/middleware/webfinger.spec.js
index fde2e428..efdfff20 100644
--- a/vnext/server/middleware/webfinger.spec.js
+++ b/vnext/server/middleware/webfinger.spec.js
@@ -1,15 +1,12 @@
import request from 'supertest'
-import express from 'express'
-import { webfinger } from './webfinger'
-const app = express()
-app.get('/webfinger', webfinger)
+import { app } from '../app'
describe('WebFinger middleware', () => {
it('Existing user response should have a subject and links', async () => {
const resource = 'acct:ugnich@juick.com'
const response = await request(app)
- .get(`/webfinger?resource=${resource}`)
+ .get(`/.well-known/webfinger?resource=${resource}`)
expect(response.status).toStrictEqual(200)
expect(response.body.subject).toStrictEqual(resource)
expect(response.body.links.length).toStrictEqual(1)
@@ -18,13 +15,13 @@ describe('WebFinger middleware', () => {
it('Unknown user should return 404', async () => {
const resource = 'acct:durov@juick.com'
const response = await request(app)
- .get(`/webfinger?resource=${resource}`)
+ .get(`/.well-known/webfinger?resource=${resource}`)
expect(response.status).toStrictEqual(404)
})
it('Invalid input should return 400', async () => {
const resource = ';DROP TABLE users'
const response = await request(app)
- .get(`/webfinger?resource=${resource}`)
+ .get(`/.well-known/webfinger?resource=${resource}`)
expect(response.status).toStrictEqual(400)
})
})