mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-06-15 19:19:35 +08:00
- 后端为失败数据库连接增加冷却窗口,避免短时间内重复真实建连 - 补充失败冷却回归测试,覆盖重复失败、冷却后重试和成功后清理场景 - 前端在后台态暂停查询页、侧边栏和表概览的自动元数据拉取 - 保持手动刷新、手动展开等显式操作行为不变
23 lines
893 B
TypeScript
23 lines
893 B
TypeScript
import { describe, expect, it } from 'vitest';
|
|
|
|
import { isAutoFetchVisible } from './autoFetchVisibility';
|
|
|
|
describe('isAutoFetchVisible', () => {
|
|
it('allows auto fetch only when the document is visible and not hidden', () => {
|
|
expect(isAutoFetchVisible({ hidden: false, visibilityState: 'visible' })).toBe(true);
|
|
});
|
|
|
|
it('blocks auto fetch when the page is hidden even if visibilityState looks visible', () => {
|
|
expect(isAutoFetchVisible({ hidden: true, visibilityState: 'visible' })).toBe(false);
|
|
});
|
|
|
|
it('blocks auto fetch when visibilityState is not visible', () => {
|
|
expect(isAutoFetchVisible({ hidden: false, visibilityState: 'hidden' })).toBe(false);
|
|
});
|
|
|
|
it('defaults to allowing auto fetch when document visibility APIs are unavailable', () => {
|
|
expect(isAutoFetchVisible(undefined)).toBe(true);
|
|
expect(isAutoFetchVisible({})).toBe(true);
|
|
});
|
|
});
|