1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-23 10:52:30 +01:00

Merge pull request #462 from hbjydev/unit-tests-expanded

Add unit tests for Gateway endpoints
This commit is contained in:
Samuel 2021-10-15 15:53:15 +02:00 committed by GitHub
commit a5811c1c09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 2799 additions and 20429 deletions

15655
api/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -63,6 +63,8 @@
"typescript-json-schema": "0.50.1"
},
"dependencies": {
"@babel/preset-env": "^7.15.8",
"@babel/preset-typescript": "^7.15.0",
"@fosscord/util": "file:../util",
"ajv": "8.6.2",
"ajv-formats": "^2.1.1",

View File

@ -1,15 +1,29 @@
import { Config } from "@fosscord/util";
import { Router, Response, Request } from "express";
import { route } from "@fosscord/api";
import { route, RouteOptions } from "@fosscord/api";
const router = Router();
router.get("/", route({}), (req: Request, res: Response) => {
const { endpointPublic } = Config.get().gateway;
res.json({ url: endpointPublic || process.env.GATEWAY || "ws://localhost:3002" });
});
export interface GatewayBotResponse {
url: string;
shards: number;
session_start_limit: {
total: number;
remaining: number;
reset_after: number;
max_concurrency: number;
}
}
router.get("/bot", route({}), (req: Request, res: Response) => {
const options: RouteOptions = {
test: {
response: {
body: "GatewayBotResponse"
}
}
};
router.get("/bot", route(options), (req: Request, res: Response) => {
const { endpointPublic } = Config.get().gateway;
res.json({
url: endpointPublic || process.env.GATEWAY || "ws://localhost:3002",

View File

@ -0,0 +1,24 @@
import { Config } from "@fosscord/util";
import { Router, Response, Request } from "express";
import { route, RouteOptions } from "@fosscord/api";
const router = Router();
export interface GatewayResponse {
url: string;
}
const options: RouteOptions = {
test: {
response: {
body: "GatewayResponse"
}
}
};
router.get("/", route(options), (req: Request, res: Response) => {
const { endpointPublic } = Config.get().gateway;
res.json({ url: endpointPublic || process.env.GATEWAY || "ws://localhost:3002" });
});
export default router;

7521
util/package-lock.json generated

File diff suppressed because it is too large Load Diff