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

17 lines
617 B
TypeScript

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