fix: close plugin workspace acceptance gaps
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import {
|
||||
parsePluginWorkspaceSearch,
|
||||
resolvePluginWorkspaceSearch,
|
||||
serializePluginWorkspaceSearch,
|
||||
} from '@/pages/Plugins/plugin-workspace-query';
|
||||
|
||||
@@ -22,6 +23,30 @@ describe('plugin workspace URL state', () => {
|
||||
expect(parsePluginWorkspaceSearch(new URLSearchParams('scope=project'), false).scope).toBe('all');
|
||||
});
|
||||
|
||||
it('reports a project-scope fallback while returning the exact canonical URL state', () => {
|
||||
const fallback = resolvePluginWorkspaceSearch(
|
||||
new URLSearchParams('scope=project&source=remote&state=broken'),
|
||||
false,
|
||||
);
|
||||
|
||||
expect(fallback).toEqual({
|
||||
filters: {
|
||||
scope: 'all', source: 'all', state: 'all', search: '', selectedKey: null,
|
||||
},
|
||||
canonicalSearch: 'scope=all&source=all&state=all',
|
||||
scopeFallback: true,
|
||||
});
|
||||
|
||||
const afterProjectAppears = resolvePluginWorkspaceSearch(new URLSearchParams(), true);
|
||||
expect(afterProjectAppears).toEqual({
|
||||
filters: {
|
||||
scope: 'project', source: 'all', state: 'all', search: '', selectedKey: null,
|
||||
},
|
||||
canonicalSearch: 'scope=project&source=all&state=all',
|
||||
scopeFallback: false,
|
||||
});
|
||||
});
|
||||
|
||||
it('round-trips canonical filters and source-qualified selection', () => {
|
||||
const serialized = serializePluginWorkspaceSearch({
|
||||
scope: 'all',
|
||||
|
||||
Reference in New Issue
Block a user