aboutsummaryrefslogtreecommitdiff
path: root/vnext/server/db/Mastodon.spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'vnext/server/db/Mastodon.spec.js')
-rw-r--r--vnext/server/db/Mastodon.spec.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/vnext/server/db/Mastodon.spec.js b/vnext/server/db/Mastodon.spec.js
new file mode 100644
index 00000000..f2edb40b
--- /dev/null
+++ b/vnext/server/db/Mastodon.spec.js
@@ -0,0 +1,21 @@
+import request from 'supertest'
+import express from 'express'
+import { instance } from '../middleware/mastodon'
+import db from './index'
+
+const app = express()
+app.get('/instance', instance)
+
+describe('Mastodon API middleware', () => {
+ it('Inactive users should not be included in Instance response', async () => {
+ await db.query('INSERT INTO users(nick,passw,last_seen) \
+ VALUES(\'ugnich\', \'12345\', NULL), \
+ (\'freefd\', \'12345\', DATETIME(\'now\'))')
+ return request(app)
+ .get('/instance')
+ .expect(200)
+ .then(response => {
+ expect(response.body.usage.users.active_month).toStrictEqual(1)
+ })
+ })
+})