import {BinToDecConverter} from './bin-to-dec-converter'; describe('BinToDecConverter', () => { let sut: BinToDecConverter; beforeEach(() => sut = new BinToDecConverter()); it('should create an instance', () => { expect(sut).toBeTruthy(); }); it('should have a display name', () => { expect(sut.getDisplayname()).toBeTruthy(); }); it('should have the id "bintodec"', () => { expect(sut.getId()).toEqual('bintodec'); }); it('should convert "11011" to "27"', () => { expect(sut.convert('11011')).toEqual('27'); }); it('should raise an exception on invalid input', () => { expect(() => sut.convert('1foo bar')).toThrowError('The input seems not to be a valid binary number.'); }); });