mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 04:27:21 +00:00
fix test typings
This commit is contained in:
@@ -32,7 +32,7 @@ describe("MediaApi", () => {
|
|||||||
host,
|
host,
|
||||||
basepath,
|
basepath,
|
||||||
});
|
});
|
||||||
expect(api.getFileUploadUrl({ path: "path" })).toBe(`${host}${basepath}/upload/path`);
|
expect(api.getFileUploadUrl({ path: "path" } as any)).toBe(`${host}${basepath}/upload/path`);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should have correct upload headers", () => {
|
it("should have correct upload headers", () => {
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ describe("OAuthStrategy", async () => {
|
|||||||
const strategy = new OAuthStrategy({
|
const strategy = new OAuthStrategy({
|
||||||
type: "oidc",
|
type: "oidc",
|
||||||
client: {
|
client: {
|
||||||
client_id: process.env.OAUTH_CLIENT_ID,
|
client_id: process.env.OAUTH_CLIENT_ID!,
|
||||||
client_secret: process.env.OAUTH_CLIENT_SECRET,
|
client_secret: process.env.OAUTH_CLIENT_SECRET!,
|
||||||
},
|
},
|
||||||
name: "google",
|
name: "google",
|
||||||
});
|
});
|
||||||
@@ -19,11 +19,6 @@ describe("OAuthStrategy", async () => {
|
|||||||
const config = await strategy.getConfig();
|
const config = await strategy.getConfig();
|
||||||
console.log("config", JSON.stringify(config, null, 2));
|
console.log("config", JSON.stringify(config, null, 2));
|
||||||
|
|
||||||
const request = await strategy.request({
|
|
||||||
redirect_uri,
|
|
||||||
state,
|
|
||||||
});
|
|
||||||
|
|
||||||
const server = Bun.serve({
|
const server = Bun.serve({
|
||||||
fetch: async (req) => {
|
fetch: async (req) => {
|
||||||
const url = new URL(req.url);
|
const url = new URL(req.url);
|
||||||
@@ -39,6 +34,11 @@ describe("OAuthStrategy", async () => {
|
|||||||
return new Response("Bun!");
|
return new Response("Bun!");
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const request = await strategy.request({
|
||||||
|
redirect_uri,
|
||||||
|
state,
|
||||||
|
});
|
||||||
console.log("request", request);
|
console.log("request", request);
|
||||||
|
|
||||||
await new Promise((resolve) => setTimeout(resolve, 100000));
|
await new Promise((resolve) => setTimeout(resolve, 100000));
|
||||||
|
|||||||
@@ -39,8 +39,8 @@ function makeName(ext: string) {
|
|||||||
return randomString(10) + "." + ext;
|
return randomString(10) + "." + ext;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*beforeAll(disableConsoleLog);
|
beforeAll(disableConsoleLog);
|
||||||
afterAll(enableConsoleLog);*/
|
afterAll(enableConsoleLog);
|
||||||
|
|
||||||
describe("MediaController", () => {
|
describe("MediaController", () => {
|
||||||
test.only("accepts direct", async () => {
|
test.only("accepts direct", async () => {
|
||||||
@@ -56,9 +56,9 @@ describe("MediaController", () => {
|
|||||||
console.log(result);
|
console.log(result);
|
||||||
expect(result.name).toBe(name);
|
expect(result.name).toBe(name);
|
||||||
|
|
||||||
/*const destFile = Bun.file(assetsTmpPath + "/" + name);
|
const destFile = Bun.file(assetsTmpPath + "/" + name);
|
||||||
expect(destFile.exists()).resolves.toBe(true);
|
expect(destFile.exists()).resolves.toBe(true);
|
||||||
await destFile.delete();*/
|
await destFile.delete();
|
||||||
});
|
});
|
||||||
|
|
||||||
test("accepts form data", async () => {
|
test("accepts form data", async () => {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Exception } from "core";
|
import { Exception, isDebug } from "core";
|
||||||
import { type Static, StringEnum, Type } from "core/utils";
|
import { type Static, StringEnum, Type } from "core/utils";
|
||||||
import { cors } from "hono/cors";
|
import { cors } from "hono/cors";
|
||||||
import { Module } from "modules/Module";
|
import { Module } from "modules/Module";
|
||||||
@@ -102,6 +102,12 @@ export class AppServer extends Module<typeof serverConfigSchema> {
|
|||||||
return c.json(err.toJSON(), err.code as any);
|
return c.json(err.toJSON(), err.code as any);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (err instanceof Error) {
|
||||||
|
if (isDebug()) {
|
||||||
|
return c.json({ error: err.message, stack: err.stack }, 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return c.json({ error: err.message }, 500);
|
return c.json({ error: err.message }, 500);
|
||||||
});
|
});
|
||||||
this.setBuilt();
|
this.setBuilt();
|
||||||
|
|||||||
Reference in New Issue
Block a user