Skip to content

Commit

Permalink
fix(devicepreferences): unwrap paged items in response
Browse files Browse the repository at this point in the history
  • Loading branch information
john-u committed Jan 18, 2022
1 parent 7a48f42 commit cfd832b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/endpoint/devicepreferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ export class DevicePreferencesEndpoint extends Endpoint {
}

public listTranslations(preferenceId: PreferenceId): Promise<LocaleReference[]> {
return this.client.get(`${preferenceId}/i18n`)
return this.client.getPagedItems(`${preferenceId}/i18n`)
}

public updateTranslations(preferenceId: PreferenceId, localization: PreferenceLocalization): Promise<PreferenceLocalization> {
Expand Down
6 changes: 3 additions & 3 deletions test/unit/devicepreferences.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,16 @@ describe('devicepreferences', () => {
})

test('list', async () => {
getSpy.mockResolvedValueOnce(MOCK_LOCALE_LIST)
getPagedItemsSpy.mockResolvedValueOnce(MOCK_LOCALE_LIST)

const response = await devicepreferences.listTranslations(preferenceId)

expect(getSpy).toBeCalledWith(`${preferenceId}/i18n`)
expect(getPagedItemsSpy).toBeCalledWith(`${preferenceId}/i18n`)
expect(response).toStrictEqual(MOCK_LOCALE_LIST)
})

test('list failure', async () => {
getSpy.mockRejectedValueOnce(error)
getPagedItemsSpy.mockRejectedValueOnce(error)

const promise = devicepreferences.listTranslations(preferenceId)

Expand Down

0 comments on commit cfd832b

Please sign in to comment.