Skip to content

Commit

Permalink
Merge pull request #100 from observerly/refactor/focuser/getPosition
Browse files Browse the repository at this point in the history
refactor: amend body type in getPosition() action in @observerly/hyper.
  • Loading branch information
michealroberts authored Apr 12, 2024
2 parents 2d874e1 + ccdfd89 commit e3bb1e2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/routes/filterwheel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const filterwheel = (
name: 'getPosition',
action: <
T = {
name: string
position: number
}
>() => {
Expand Down Expand Up @@ -138,7 +139,7 @@ export const filterwheel = (
position: number
}
>(body: {
filter: string
name: string
}) => {
const url = new URL('filterwheel/name', base)

Expand Down
4 changes: 2 additions & 2 deletions tests/filterwheelRoutes.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ suite('@observerly/hyper Fiber API Filterwheel Client', () => {
const position = await client.filterwheel.getPosition()
expect(isDataResult(position)).toBe(true)
if (!isDataResult(position)) return
expect(position).toStrictEqual({ position: 0 })
expect(position).toStrictEqual({ name: 'R', position: 0 })
})

it('should be able to determine the names of the filters in the filterwheel', async () => {
Expand Down Expand Up @@ -76,7 +76,7 @@ suite('@observerly/hyper Fiber API Filterwheel Client', () => {

it('should be able to set the position of the filterwheel using the filter name', async () => {
const client = setupClient(getURL('/api/v1/'))
const position = await client.filterwheel.setFilter({ filter: 'R' })
const position = await client.filterwheel.setFilter({ name: 'R' })
expect(isDataResult(position)).toBe(true)
if (!isDataResult(position)) return
expect(position).toStrictEqual({ position: 1 })
Expand Down
1 change: 1 addition & 0 deletions tests/mocks/filterwheel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export const filterwheelHandlers: Handler[] = [
}

return {
name: 'R',
position: 0
}
})
Expand Down

0 comments on commit e3bb1e2

Please sign in to comment.