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