feat: 支持工作流对话匿名分享
- 增加免登录公共接口、访客隔离、限流和匿名上传校验 - 分离 SSE 连接与运行生命周期,支持刷新恢复服务端权威状态 - 持久化分享页对话并优化时间线滚动与输入区交互
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
import { createMemoryHistory, createRouter } from 'vue-router';
|
||||
|
||||
import { useAccessStore } from '@easyflow/stores';
|
||||
|
||||
import { createPinia, setActivePinia } from 'pinia';
|
||||
import { beforeEach, describe, expect, it } from 'vitest';
|
||||
|
||||
import { createRouterGuard } from '../guard';
|
||||
|
||||
describe('public route guard', () => {
|
||||
beforeEach(() => {
|
||||
setActivePinia(createPinia());
|
||||
});
|
||||
|
||||
it('bypasses stale login state for an anonymous workflow share', async () => {
|
||||
const accessStore = useAccessStore();
|
||||
accessStore.setAccessToken('stale-token');
|
||||
const router = createRouter({
|
||||
history: createMemoryHistory(),
|
||||
routes: [
|
||||
{
|
||||
component: { template: '<div>login</div>' },
|
||||
name: 'Login',
|
||||
path: '/auth/login',
|
||||
},
|
||||
{
|
||||
component: { template: '<div>workflow share</div>' },
|
||||
meta: { ignoreAccess: true, title: 'Workflow Share' },
|
||||
name: 'WorkflowShare',
|
||||
path: '/share/workflow',
|
||||
},
|
||||
],
|
||||
});
|
||||
createRouterGuard(router);
|
||||
|
||||
await router.push('/share/workflow?shareKey=share-key');
|
||||
await router.isReady();
|
||||
|
||||
expect(router.currentRoute.value.name).toBe('WorkflowShare');
|
||||
expect(router.currentRoute.value.query.shareKey).toBe('share-key');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user