fix: tab title was broken
This commit is contained in:
@@ -69,6 +69,10 @@ describe('TabBar', () => {
|
||||
get: vi.fn(),
|
||||
onNameUpdated: vi.fn(() => () => {}),
|
||||
},
|
||||
scripts: {
|
||||
...(window as any).electronAPI?.scripts,
|
||||
get: vi.fn(),
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
@@ -136,4 +140,24 @@ describe('TabBar', () => {
|
||||
|
||||
expect(await screen.findByText('Updated Title')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('renders script title for script tab', async () => {
|
||||
useAppStore.setState({
|
||||
tabs: [{ type: 'scripts', id: 'script-1', isTransient: false }],
|
||||
activeTabId: 'script-1',
|
||||
posts: [],
|
||||
media: [],
|
||||
dirtyPosts: new Set<string>(),
|
||||
});
|
||||
|
||||
(window as any).electronAPI.scripts.get = vi.fn().mockResolvedValue({
|
||||
id: 'script-1',
|
||||
title: 'Publish Macro',
|
||||
});
|
||||
|
||||
render(<TabBar />);
|
||||
|
||||
expect(await screen.findByText('Publish Macro')).toBeInTheDocument();
|
||||
expect((window as any).electronAPI.scripts.get).toHaveBeenCalledWith('script-1');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user