test: fix tests

This commit is contained in:
Julian Lam
2024-02-20 15:01:38 -05:00
parent 3e02efcdb9
commit e138b915b9
10 changed files with 146 additions and 1 deletions

View File

@@ -42,6 +42,8 @@
"flags": "Flags",
"flag-details": "Flag %1 Details",
"world": "World",
"account/edit": "Editing \"%1\"",
"account/edit/password": "Editing password of \"%1\"",
"account/edit/username": "Editing username of \"%1\"",

View File

@@ -7,6 +7,9 @@ PostObject:
tid:
type: number
description: A topic identifier
toPid:
type: number
description: The post that this post is in reply to
content:
type: string
uid:

View File

@@ -324,5 +324,9 @@ paths:
$ref: 'read/groups/slug.yaml'
"/api/groups/{slug}/members":
$ref: 'read/groups/slug/members.yaml'
"/api/world":
$ref: 'read/world.yaml'
"/api/world/{filter}":
$ref: 'read/world.yaml'
/api/outgoing:
$ref: 'read/outgoing.yaml'

View File

@@ -59,6 +59,9 @@ get:
tid:
type: number
description: A topic identifier
toPid:
type: number
description: The post that this post is in reply to
content:
type: string
timestamp:
@@ -84,6 +87,13 @@ get:
type: string
index:
type: number
parent:
type: object
properties:
username:
type: string
displayname:
type: string
user:
type: object
properties:

View File

@@ -0,0 +1,117 @@
get:
tags:
- topics
summary: Get external topics
description: Returns a list of external topics known to the local instance
responses:
"200":
description: An array of topic objects sorted by timestamp.
content:
application/json:
schema:
allOf:
- type: object
properties:
topicCount:
type: number
topics:
type: array
items:
$ref: ../components/schemas/TopicObject.yaml#/TopicObject
# tids:
# type: array
# items:
# type: number
# canPost:
# type: boolean
# showSelect:
# type: boolean
# showTopicTools:
# type: boolean
# allCategoriesUrl:
# type: string
# selectedCategory:
# type: object
# properties:
# icon:
# type: string
# name:
# type: string
# bgColor:
# type: string
# nullable: true
# selectedCids:
# type: array
# items:
# type: number
# selectedTag:
# type: object
# properties:
# label:
# type: string
# nullable: true
# selectedTags:
# type: array
# items:
# type: string
# feeds:disableRSS:
# type: number
# rssFeedUrl:
# type: string
# title:
# type: string
# filters:
# type: array
# items:
# type: object
# properties:
# name:
# type: string
# url:
# type: string
# selected:
# type: boolean
# filter:
# type: string
# icon:
# type: string
# selectedFilter:
# type: object
# properties:
# name:
# type: string
# url:
# type: string
# selected:
# type: boolean
# filter:
# type: string
# icon:
# type: string
# terms:
# type: array
# items:
# type: object
# properties:
# name:
# type: string
# url:
# type: string
# selected:
# type: boolean
# term:
# type: string
# selectedTerm:
# type: object
# properties:
# name:
# type: string
# url:
# type: string
# selected:
# type: boolean
# term:
# type: string
- $ref: ../components/schemas/Pagination.yaml#/Pagination
- $ref: ../components/schemas/Breadcrumbs.yaml#/Breadcrumbs
- $ref: ../components/schemas/CommonProps.yaml#/CommonProps

View File

@@ -32,6 +32,9 @@ get:
tid:
type: number
description: A topic identifier
toPid:
type: number
description: The post that this post is in reply to
content:
type: string
timestamp:

View File

@@ -38,6 +38,9 @@ get:
tid:
type: number
description: A topic identifier
toPid:
type: number
description: The post that this post is in reply to
content:
type: string
uid:

View File

@@ -32,6 +32,8 @@ controller.list = async function (req, res) {
data.topics = await topics.getTopicsByTids(tids, { uid: req.uid });
topics.calculateTopicIndices(data.topics, start);
data.breadcrumbs = helpers.buildBreadcrumbs([{ text: `[[pages:world]]` }]);
const pageCount = Math.max(1, Math.ceil(data.topicCount / topicsPerPage));
data.pagination = pagination.create(page, pageCount, req.query);
helpers.addLinkTags({

View File

@@ -65,7 +65,7 @@ recentController.getData = async function (req, url, sort) {
data.title = meta.config.homePageTitle || '[[pages:home]]';
} else {
data.title = `[[pages:${url}]]`;
data.breadcrumbs = helpers.buildBreadcrumbs([{ text: `[[${url}:title]]` }]);
data.breadcrumbs = helpers.buildBreadcrumbs([{ text: `[[activitypub:world-title]]` }]);
}
const query = { ...req.query };

View File

@@ -241,6 +241,7 @@ describe('API', async () => {
meta.config.allowTopicsThumbnail = 1;
meta.config.termsOfUse = 'I, for one, welcome our new test-driven overlords';
meta.config.chatMessageDelay = 0;
meta.config.activitypubEnabled = 1;
// Create a category
const testCategory = await categories.create({ name: 'test' });