import { FuelUsageController } from './FuelUsagePanel'; import { supplierTariffs } from '../../common/entities/Suppliers.fixture'; import * as TypeMoq from 'typemoq'; import { expect } from 'chai'; describe('Fuel usage panel directive', () => { it('should load the tariffs when the supplier is picked', () => { const ctrl = new FuelUsageController(); ctrl.getTariffs = () => Promise.resolve(supplierTariffs); expect(ctrl.selectSupplier({ id: '', name: '', imgURL: '', regionalBigSix: true }) .then(() => ctrl.tariffs)).to.eventually.equal(supplierTariffs); }); it('should toggle the expander', () => { const ctrl = new FuelUsageController(); expect(ctrl.collapsed).to.be.false; ctrl.toggleExpander(); expect(ctrl.collapsed).to.be.true; ctrl.toggleExpander(); expect(ctrl.collapsed).to.be.false; }); });