|
@@ -3,7 +3,6 @@ import 'reflect-metadata'
|
|
|
import { AxiosInstance } from 'axios'
|
|
|
|
|
|
import { AuthHttpService } from './AuthHttpService'
|
|
|
-import { SettingName } from '@standardnotes/settings'
|
|
|
|
|
|
describe('AuthHttpService', () => {
|
|
|
let httpClient: AxiosInstance
|
|
@@ -36,39 +35,4 @@ describe('AuthHttpService', () => {
|
|
|
validateStatus: expect.any(Function),
|
|
|
})
|
|
|
})
|
|
|
-
|
|
|
- it('should send a request to auth service in order to get user setting', async () => {
|
|
|
- httpClient.request = jest.fn().mockReturnValue({
|
|
|
- data: {
|
|
|
- setting: [
|
|
|
- {
|
|
|
- uuid: '1-2-3',
|
|
|
- value: 'yes',
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- })
|
|
|
-
|
|
|
- await createService().getUserSetting('1-2-3', SettingName.NAMES.MuteFailedBackupsEmails)
|
|
|
-
|
|
|
- expect(httpClient.request).toHaveBeenCalledWith({
|
|
|
- method: 'GET',
|
|
|
- headers: {
|
|
|
- Accept: 'application/json',
|
|
|
- },
|
|
|
- url: 'https://auth-server/internal/users/1-2-3/settings/MUTE_FAILED_BACKUPS_EMAILS',
|
|
|
- validateStatus: expect.any(Function),
|
|
|
- })
|
|
|
- })
|
|
|
-
|
|
|
- it('should throw an error if a request to auth service in order to get user setting fails', async () => {
|
|
|
- let error = null
|
|
|
- try {
|
|
|
- await createService().getUserSetting('1-2-3', SettingName.NAMES.MuteFailedCloudBackupsEmails)
|
|
|
- } catch (caughtError) {
|
|
|
- error = caughtError
|
|
|
- }
|
|
|
-
|
|
|
- expect(error).not.toBeNull()
|
|
|
- })
|
|
|
})
|