converter/src/app/converter/dec-to-bin-converter.spec.ts

17 lines
623 B
TypeScript

import {DecToBinConverter} from './dec-to-bin-converter';
describe('DecToBinConverter', () => {
it('should create an instance', () => {
expect(new DecToBinConverter()).toBeTruthy();
});
it('should have the id "dectobin"', () => {
expect(new DecToBinConverter().getId()).toEqual('dectobin');
});
it('should convert "22" to "10110"', () => {
expect(new DecToBinConverter().convert('22')).toEqual('10110');
});
it('should raise an exception on invalid input', () => {
expect(() => new DecToBinConverter().convert('foo bar')).toThrowError('The input seems not to be a valid integer.');
});
});