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