mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-21 17:27:54 +00:00
refactor: refactor settings to a nested structure (#7244)
This commit is contained in:
@@ -313,6 +313,7 @@ describe('App UI', () => {
|
||||
workspaceSettingsFile,
|
||||
[],
|
||||
true,
|
||||
new Set(),
|
||||
);
|
||||
};
|
||||
|
||||
@@ -684,7 +685,10 @@ describe('App UI', () => {
|
||||
|
||||
it('should display custom contextFileName in footer when set and count is 1', async () => {
|
||||
mockSettings = createMockSettings({
|
||||
workspace: { contextFileName: 'AGENTS.md', theme: 'Default' },
|
||||
workspace: {
|
||||
context: { fileName: 'AGENTS.md' },
|
||||
ui: { theme: 'Default' },
|
||||
},
|
||||
});
|
||||
mockConfig.getGeminiMdFileCount.mockReturnValue(1);
|
||||
mockConfig.getAllGeminiMdFilenames.mockReturnValue(['AGENTS.md']);
|
||||
@@ -706,8 +710,8 @@ describe('App UI', () => {
|
||||
it('should display a generic message when multiple context files with different names are provided', async () => {
|
||||
mockSettings = createMockSettings({
|
||||
workspace: {
|
||||
contextFileName: ['AGENTS.md', 'CONTEXT.md'],
|
||||
theme: 'Default',
|
||||
context: { fileName: ['AGENTS.md', 'CONTEXT.md'] },
|
||||
ui: { theme: 'Default' },
|
||||
},
|
||||
});
|
||||
mockConfig.getGeminiMdFileCount.mockReturnValue(2);
|
||||
@@ -732,7 +736,10 @@ describe('App UI', () => {
|
||||
|
||||
it('should display custom contextFileName with plural when set and count is > 1', async () => {
|
||||
mockSettings = createMockSettings({
|
||||
workspace: { contextFileName: 'MY_NOTES.TXT', theme: 'Default' },
|
||||
workspace: {
|
||||
context: { fileName: 'MY_NOTES.TXT' },
|
||||
ui: { theme: 'Default' },
|
||||
},
|
||||
});
|
||||
mockConfig.getGeminiMdFileCount.mockReturnValue(3);
|
||||
mockConfig.getAllGeminiMdFilenames.mockReturnValue([
|
||||
@@ -757,7 +764,10 @@ describe('App UI', () => {
|
||||
|
||||
it('should not display context file message if count is 0, even if contextFileName is set', async () => {
|
||||
mockSettings = createMockSettings({
|
||||
workspace: { contextFileName: 'ANY_FILE.MD', theme: 'Default' },
|
||||
workspace: {
|
||||
context: { fileName: 'ANY_FILE.MD' },
|
||||
ui: { theme: 'Default' },
|
||||
},
|
||||
});
|
||||
mockConfig.getGeminiMdFileCount.mockReturnValue(0);
|
||||
mockConfig.getAllGeminiMdFilenames.mockReturnValue([]);
|
||||
@@ -838,7 +848,7 @@ describe('App UI', () => {
|
||||
it('should not display Tips component when hideTips is true', async () => {
|
||||
mockSettings = createMockSettings({
|
||||
workspace: {
|
||||
hideTips: true,
|
||||
ui: { hideTips: true },
|
||||
},
|
||||
});
|
||||
|
||||
@@ -871,7 +881,7 @@ describe('App UI', () => {
|
||||
it('should not display Header component when hideBanner is true', async () => {
|
||||
const { Header } = await import('./components/Header.js');
|
||||
mockSettings = createMockSettings({
|
||||
user: { hideBanner: true },
|
||||
user: { ui: { hideBanner: true } },
|
||||
});
|
||||
|
||||
const { unmount } = renderWithProviders(
|
||||
@@ -902,7 +912,7 @@ describe('App UI', () => {
|
||||
|
||||
it('should not display Footer component when hideFooter is true', async () => {
|
||||
mockSettings = createMockSettings({
|
||||
user: { hideFooter: true },
|
||||
user: { ui: { hideFooter: true } },
|
||||
});
|
||||
|
||||
const { lastFrame, unmount } = renderWithProviders(
|
||||
@@ -920,9 +930,9 @@ describe('App UI', () => {
|
||||
|
||||
it('should show footer if system says show, but workspace and user settings say hide', async () => {
|
||||
mockSettings = createMockSettings({
|
||||
system: { hideFooter: false },
|
||||
user: { hideFooter: true },
|
||||
workspace: { hideFooter: true },
|
||||
system: { ui: { hideFooter: false } },
|
||||
user: { ui: { hideFooter: true } },
|
||||
workspace: { ui: { hideFooter: true } },
|
||||
});
|
||||
|
||||
const { lastFrame, unmount } = renderWithProviders(
|
||||
@@ -940,9 +950,9 @@ describe('App UI', () => {
|
||||
|
||||
it('should show tips if system says show, but workspace and user settings say hide', async () => {
|
||||
mockSettings = createMockSettings({
|
||||
system: { hideTips: false },
|
||||
user: { hideTips: true },
|
||||
workspace: { hideTips: true },
|
||||
system: { ui: { hideTips: false } },
|
||||
user: { ui: { hideTips: true } },
|
||||
workspace: { ui: { hideTips: true } },
|
||||
});
|
||||
|
||||
const { unmount } = renderWithProviders(
|
||||
@@ -1117,9 +1127,13 @@ describe('App UI', () => {
|
||||
const validateAuthMethodSpy = vi.spyOn(auth, 'validateAuthMethod');
|
||||
mockSettings = createMockSettings({
|
||||
workspace: {
|
||||
selectedAuthType: 'USE_GEMINI' as AuthType,
|
||||
useExternalAuth: false,
|
||||
theme: 'Default',
|
||||
security: {
|
||||
auth: {
|
||||
selectedType: 'USE_GEMINI' as AuthType,
|
||||
useExternal: false,
|
||||
},
|
||||
},
|
||||
ui: { theme: 'Default' },
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1139,9 +1153,13 @@ describe('App UI', () => {
|
||||
const validateAuthMethodSpy = vi.spyOn(auth, 'validateAuthMethod');
|
||||
mockSettings = createMockSettings({
|
||||
workspace: {
|
||||
selectedAuthType: 'USE_GEMINI' as AuthType,
|
||||
useExternalAuth: true,
|
||||
theme: 'Default',
|
||||
security: {
|
||||
auth: {
|
||||
selectedType: 'USE_GEMINI' as AuthType,
|
||||
useExternal: true,
|
||||
},
|
||||
},
|
||||
ui: { theme: 'Default' },
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1536,8 +1554,8 @@ describe('App UI', () => {
|
||||
it('should pass debugKeystrokeLogging setting to KeypressProvider', () => {
|
||||
const mockSettingsWithDebug = createMockSettings({
|
||||
workspace: {
|
||||
theme: 'Default',
|
||||
debugKeystrokeLogging: true,
|
||||
ui: { theme: 'Default' },
|
||||
advanced: { debugKeystrokeLogging: true },
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1553,7 +1571,9 @@ describe('App UI', () => {
|
||||
const output = lastFrame();
|
||||
|
||||
expect(output).toBeDefined();
|
||||
expect(mockSettingsWithDebug.merged.debugKeystrokeLogging).toBe(true);
|
||||
expect(mockSettingsWithDebug.merged.advanced?.debugKeystrokeLogging).toBe(
|
||||
true,
|
||||
);
|
||||
});
|
||||
|
||||
it('should use default false value when debugKeystrokeLogging is not set', () => {
|
||||
@@ -1569,7 +1589,9 @@ describe('App UI', () => {
|
||||
const output = lastFrame();
|
||||
|
||||
expect(output).toBeDefined();
|
||||
expect(mockSettings.merged.debugKeystrokeLogging).toBeUndefined();
|
||||
expect(
|
||||
mockSettings.merged.advanced?.debugKeystrokeLogging,
|
||||
).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user