/* tslint:disable: no-unused-expression */ import nock from 'nock' import chai, { expect } from 'chai' import chaiAsPromised from 'chai-as-promised' import aitmedApi from '../client' import * as types from '../types/sdk' chai.use(chaiAsPromised) const version = 'v2' const tvKeys = { accountId: 'some_accountId', groupIds: 'some_groupIds', passwordResetFlowId: 'some_passwordResetFlowId', registerToken: 'some_registerToken', scopedAccessToken: 'some_scopedAccessToken', vaultId: 'some_vaultId', appointmentVaultId: 'some_appointmentVaultId', sentryApiKey: 'some_sentryApiKey', googleApiKey: 'some_googleApiKey', } const baseURL = `https://testapi.aitmed.com` const baseTvURL = 'https://api.truevault.com' let client: any beforeEach(() => { client = aitmedApi({ env: 'testapi', tvKeys, baseURL }) }) afterEach(() => { nock.cleanAll() }) describe('patients', () => { describe('.auth', () => { beforeEach(() => { nock(baseURL) .post(`/${version}/account/patient/login/`) .reply(200, { data: { user_id: 'uid123', tv_uid: 'tvuid123', jwt_token: 'jwt123', tv_access_token: 'tvaccesstoken123', }, }) }) it('should return the data object from response', () => { const params = { phone_number: 'p123', password: 'pass123' } client.setAccountType('patient') return expect(client.account.patient.auth(params)).to.eventually.include({ user_id: 'uid123', tv_uid: 'tvuid123', jwt_token: 'jwt123', tv_access_token: 'tvaccesstoken123', }) }) }) })