Skip to content

Commit f3e4e12

Browse files
waleedlatif1claude
andcommitted
test(desktop): give the tab-resource hosts the shared options interface
The test hosts took their props through a type alias derived from the hook signature. The repo asks for an interface, and the hook already exports one that is exactly this shape, so the hosts use it directly instead of restating it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0139YonWmiZUnPMTHoH4PtAJ
1 parent 7943024 commit f3e4e12

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

apps/sim/app/workspace/[workspaceId]/home/hooks/use-browser-tab-resources.test.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { createRoot, type Root } from 'react-dom/client'
66
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
77
import type { MothershipResource } from '@/lib/copilot/resources/types'
88
import { useBrowserTabResources } from '@/app/workspace/[workspaceId]/home/hooks/use-browser-tab-resources'
9+
import type { DesktopTabStripOptions } from '@/app/workspace/[workspaceId]/home/hooks/use-desktop-tab-resources'
910
import { useBrowserSessionStore } from '@/stores/browser-session/store'
1011

1112
const { sendBrowserPanelAction, openUrlInNewBrowserTab, openInPanelListeners } = vi.hoisted(() => ({
@@ -37,9 +38,7 @@ function pushTabs(scopeId: string, tabs: ReturnType<typeof tab>[], activeTabId:
3738
})
3839
}
3940

40-
type HostProps = Parameters<typeof useBrowserTabResources>[0]
41-
42-
function Host(props: HostProps) {
41+
function Host(props: DesktopTabStripOptions) {
4342
useBrowserTabResources(props)
4443
return null
4544
}
@@ -53,8 +52,8 @@ describe('useBrowserTabResources', () => {
5352
const restoreResource = vi.fn()
5453
const onResourceEvent = vi.fn()
5554

56-
function render(overrides: Partial<HostProps> = {}) {
57-
const props: HostProps = {
55+
function render(overrides: Partial<DesktopTabStripOptions> = {}) {
56+
const props: DesktopTabStripOptions = {
5857
scopeId: SCOPE,
5958
resources: [],
6059
activeResourceId: null,
@@ -68,7 +67,8 @@ describe('useBrowserTabResources', () => {
6867
...overrides,
6968
}
7069
act(() => root.render(<Host {...props} />))
71-
return (next: Partial<HostProps>) => act(() => root.render(<Host {...props} {...next} />))
70+
return (next: Partial<DesktopTabStripOptions>) =>
71+
act(() => root.render(<Host {...props} {...next} />))
7272
}
7373

7474
beforeEach(() => {

apps/sim/app/workspace/[workspaceId]/home/hooks/use-terminal-tab-resources.test.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import type { TerminalTabState } from '@sim/terminal-protocol'
66
import { createRoot, type Root } from 'react-dom/client'
77
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
88
import type { MothershipResource } from '@/lib/copilot/resources/types'
9+
import type { DesktopTabStripOptions } from '@/app/workspace/[workspaceId]/home/hooks/use-desktop-tab-resources'
910
import { useTerminalTabResources } from '@/app/workspace/[workspaceId]/home/hooks/use-terminal-tab-resources'
1011
import { useCopilotTerminalStore } from '@/stores/copilot-terminal/store'
1112

@@ -38,9 +39,7 @@ function pushTabs(scopeId: string, tabs: TerminalTabState[], activeTerminalId: s
3839
})
3940
}
4041

41-
type HostProps = Parameters<typeof useTerminalTabResources>[0]
42-
43-
function Host(props: HostProps) {
42+
function Host(props: DesktopTabStripOptions) {
4443
useTerminalTabResources(props)
4544
return null
4645
}
@@ -54,8 +53,8 @@ describe('useTerminalTabResources', () => {
5453
const restoreResource = vi.fn()
5554
const onResourceEvent = vi.fn()
5655

57-
function render(overrides: Partial<HostProps> = {}) {
58-
const props: HostProps = {
56+
function render(overrides: Partial<DesktopTabStripOptions> = {}) {
57+
const props: DesktopTabStripOptions = {
5958
scopeId: SCOPE,
6059
resources: [],
6160
activeResourceId: null,
@@ -69,7 +68,8 @@ describe('useTerminalTabResources', () => {
6968
...overrides,
7069
}
7170
act(() => root.render(<Host {...props} />))
72-
return (next: Partial<HostProps>) => act(() => root.render(<Host {...props} {...next} />))
71+
return (next: Partial<DesktopTabStripOptions>) =>
72+
act(() => root.render(<Host {...props} {...next} />))
7373
}
7474

7575
beforeEach(() => {

0 commit comments

Comments
 (0)