Skip to content

Commit

Permalink
fix(jest): adjust incoming types in CapabilitiesManager
Browse files Browse the repository at this point in the history
Signed-off-by: Maksim Sukharev <antreesy.web@gmail.com>
  • Loading branch information
Antreesy committed Dec 2, 2024
1 parent 91fd4b9 commit 1e3a566
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/services/CapabilitiesManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@ export async function setRemoteCapabilities(joinRoomResponse: JoinRoomFullRespon
talkHashStore.setTalkProxyHashDirty(token)

const response = await getRemoteCapabilities(token)
if (Array.isArray(response.data.ocs.data)) {
// unknown[] received from server, nothing to update with
if (!Object.keys(response.data.ocs.data).length) {
// data: {} received from server, nothing to update with
return
}

remoteCapabilities[remoteServer] = { spreed: response.data.ocs.data }
remoteCapabilities[remoteServer] = { spreed: (response.data.ocs.data as Capabilities['spreed']) }
remoteCapabilities[remoteServer].hash = joinRoomResponse.headers['x-nextcloud-talk-proxy-hash']
BrowserStorage.setItem('remoteCapabilities', JSON.stringify(remoteCapabilities))
patchTokenMap(joinRoomResponse.data.ocs.data)
Expand Down
2 changes: 1 addition & 1 deletion src/services/__tests__/CapabilitiesManager.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ describe('CapabilitiesManager', () => {
headers: { 'x-nextcloud-talk-proxy-hash': `${remoteCapabilities.hash}001` },
payload: { token, remoteServer },
})
const responseMock = generateOCSResponse({ payload: [] })
const responseMock = generateOCSResponse({ payload: {} })
getRemoteCapabilities.mockReturnValue(responseMock)
await setRemoteCapabilities(joinRoomResponseMock)
expect(talkHashStore.isNextcloudTalkProxyHashDirty[token]).toBeTruthy()
Expand Down

0 comments on commit 1e3a566

Please sign in to comment.