mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-20 10:10:56 -07:00
Improve test coverage for cli/src/ui/components (#13598)
This commit is contained in:
@@ -157,8 +157,7 @@ describe('SessionBrowser component', () => {
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(lastFrame()).toContain('No auto-saved conversations found.');
|
||||
expect(lastFrame()).toContain('Press q to exit');
|
||||
expect(lastFrame()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('renders a list of sessions and marks current session as disabled', () => {
|
||||
@@ -193,11 +192,7 @@ describe('SessionBrowser component', () => {
|
||||
/>,
|
||||
);
|
||||
|
||||
const output = lastFrame();
|
||||
expect(output).toContain('Chat Sessions (2 total');
|
||||
expect(output).toContain('First conversation about cats');
|
||||
expect(output).toContain('Second conversation about dogs');
|
||||
expect(output).toContain('(current)');
|
||||
expect(lastFrame()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('enters search mode, filters sessions, and renders match snippets', async () => {
|
||||
@@ -214,6 +209,7 @@ describe('SessionBrowser component', () => {
|
||||
},
|
||||
],
|
||||
index: 0,
|
||||
lastUpdated: '2025-01-01T12:00:00Z',
|
||||
});
|
||||
|
||||
const otherSession = createSession({
|
||||
@@ -229,6 +225,7 @@ describe('SessionBrowser component', () => {
|
||||
},
|
||||
],
|
||||
index: 1,
|
||||
lastUpdated: '2025-01-01T10:00:00Z',
|
||||
});
|
||||
|
||||
const config = createMockConfig();
|
||||
@@ -259,15 +256,9 @@ describe('SessionBrowser component', () => {
|
||||
}
|
||||
|
||||
await waitFor(() => {
|
||||
const output = lastFrame();
|
||||
expect(output).toContain('Chat Sessions (1 total, filtered');
|
||||
expect(output).toContain('Query is here');
|
||||
expect(output).not.toContain('Nothing interesting here.');
|
||||
|
||||
expect(output).toContain('You:');
|
||||
expect(output).toContain('query');
|
||||
expect(output).toContain('(+1 more)');
|
||||
expect(lastFrame()).toContain('Chat Sessions (1 total, filtered');
|
||||
});
|
||||
expect(lastFrame()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('handles keyboard navigation and resumes the selected session', () => {
|
||||
@@ -276,12 +267,14 @@ describe('SessionBrowser component', () => {
|
||||
file: 'one',
|
||||
displayName: 'First session',
|
||||
index: 0,
|
||||
lastUpdated: '2025-01-02T12:00:00Z',
|
||||
});
|
||||
const session2 = createSession({
|
||||
id: 'two',
|
||||
file: 'two',
|
||||
displayName: 'Second session',
|
||||
index: 1,
|
||||
lastUpdated: '2025-01-01T12:00:00Z',
|
||||
});
|
||||
|
||||
const config = createMockConfig();
|
||||
@@ -317,6 +310,7 @@ describe('SessionBrowser component', () => {
|
||||
displayName: 'Current session',
|
||||
isCurrentSession: true,
|
||||
index: 0,
|
||||
lastUpdated: '2025-01-02T12:00:00Z',
|
||||
});
|
||||
const otherSession = createSession({
|
||||
id: 'other',
|
||||
@@ -324,6 +318,7 @@ describe('SessionBrowser component', () => {
|
||||
displayName: 'Other session',
|
||||
isCurrentSession: false,
|
||||
index: 1,
|
||||
lastUpdated: '2025-01-01T12:00:00Z',
|
||||
});
|
||||
|
||||
const config = createMockConfig();
|
||||
@@ -364,8 +359,6 @@ describe('SessionBrowser component', () => {
|
||||
/>,
|
||||
);
|
||||
|
||||
const output = lastFrame();
|
||||
expect(output).toContain('Error: storage failure');
|
||||
expect(output).toContain('Press q to exit');
|
||||
expect(lastFrame()).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user