mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-08-30 16:55:08 +08:00
bb12119123
* feat(types): add upvotes, downvotes, and comments to DataItem * refactor: fix TS2339 * refactor: fix TS2322 * refactor: fix TS2322 * refactor: fix TS2345 * refactor: fix TS2339 * refactor: fix TS2322 * refactor: fix TS2345 * refactor: fix TS2531/2532/18048/18047 * refactor: fix TS18046/TS2571 * refactor: fix TS2538 * refactor: fix TS2554/2769/2558 * refactor: fix TS2362/2363 * refactor: fix TS2353/TS2561 * refactor: fix TS2741/2739/2740 * refactor: fix TS2304 TS2307 TS2305 TS2614 TS2552 TS2551 * refactor: fix TS2352 * refactor: fix TS2604 TS17001 * refactor: fix TS2367 TS2366 * refactor: fix TS2493 * refactor: fix TS2454 * refactor: fix TS2790 * refactor: fix TS2488 * refactor: fix TS2677 * refactor: fix TS18048/18049/2532 * refactor: fix TS2322 * refactor: fix TS2344 * refactor: fix TS2339 * refactor: fix TS2339 * refactor: fix TS2365 * refactor: fix TS1117 * refactor: fix TS2561 * refactor: fix TS2555 * refactor: fix TS2503 * refactor: fix TS2339 mobile api no longer work * fix: clean slop * fix: use Context instead of any * fix: fix more typing after merge * fix: add void return for ctx.redirect in handler * chore: add type check to lint and husky * fix: remove ts ignore * chore: add oxlint rule * fix: suppress build artifact * fix: update getArticles to use cache * fix: codeql * fix(route/typeless): use async gunzip * fix: address review * fix: address review * fix: double quotes escape
30 lines
814 B
TypeScript
30 lines
814 B
TypeScript
import type { Context, Next } from 'hono';
|
|
import { describe, expect, it } from 'vitest';
|
|
|
|
import { config } from '@/config';
|
|
import trace from '@/middleware/trace';
|
|
|
|
describe('trace middleware', () => {
|
|
it('skips tracing when debugInfo is disabled', async () => {
|
|
const originalDebug = config.debugInfo;
|
|
config.debugInfo = false as unknown as string;
|
|
|
|
let called = false;
|
|
const ctx = {
|
|
req: {
|
|
method: 'GET',
|
|
raw: new Request('http://localhost/test'),
|
|
},
|
|
} as unknown as Context;
|
|
const next: Next = () => {
|
|
called = true;
|
|
return Promise.resolve();
|
|
};
|
|
|
|
await trace(ctx, next);
|
|
expect(called).toBe(true);
|
|
|
|
config.debugInfo = originalDebug;
|
|
});
|
|
});
|