import { appConfig } from '../common/entities/AppConfig.fixture'; import { LayoutController } from './Layout'; import { AgentAuthClient } from '../common/clients/AgentAuthClient'; import { Mock, It, IMock, Times } from 'typemoq'; import { expect } from 'chai'; describe('Layout controller', () => { const agentAuthClient = Mock.ofType(); const agentState = { username: '' }; it('should set the agent name if the agent is already logged in', () => { appConfig.csa = true; const authResponse = Promise.resolve({ data: { username: 'name' } }); agentAuthClient.setup(x => x.user()).returns(() => authResponse); const controller = new LayoutController(appConfig, null, agentState, agentAuthClient.object); return authResponse.then(_ => expect(agentState.username).to.equal('name') ); }); });