mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-10-18 14:29:01 +08:00
08a38f0a5e
* refactor: typing house-keeping * fix: fix parse date not accepting strict mode * refactor: use npm package * fix: address review
25 lines
682 B
TypeScript
25 lines
682 B
TypeScript
import { Context, type 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 = '';
|
|
|
|
let called = false;
|
|
const ctx = new Context(new Request('http://localhost/test'));
|
|
const next: Next = () => {
|
|
called = true;
|
|
return Promise.resolve();
|
|
};
|
|
|
|
await trace(ctx, next);
|
|
expect(called).toBe(true);
|
|
|
|
config.debugInfo = originalDebug;
|
|
});
|
|
});
|