Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/routes/telescope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,29 @@ export const telescope = (
)
}
},
{
name: 'disconnect',
action: <
T = {
connected: boolean
}
>() => {
const url = new URL('telescope/connect', base)

const data = JSON.stringify({ connect: false })

return dispatchRequest<T>(
url,
{
...init,
method: 'PUT',
body: JSON.stringify({ connect: false })
},
headers,
data
)
}
},
{
name: 'slewToEquatorialCoordinate',
action: <
Expand Down
6 changes: 6 additions & 0 deletions tests/telescopeRoutes.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ suite('@observerly/hyper Fiber API Telescope Client', () => {
expect(connected).toBe(true)
})

it('should be able to disconnect from the telescope', async () => {
const client = setupClient(getURL('/api/v1/'))
const { connected } = await client.telescope.disconnect()
expect(connected).toBe(false)
})

it('should be able to set the equatorial coordinates of the telescope', async () => {
const client = setupClient(getURL('/api/v1/'))
const { slewing } = await client.telescope.slewToEquatorialCoordinate({
Expand Down