Fix naming, add tests #5
5 changed files with 19 additions and 3 deletions
|
@ -3,7 +3,7 @@ import {Base64Encoder} from './converter/base64-encoder';
|
|||
import {BinToDecConverter} from './converter/bin-to-dec-converter';
|
||||
import {Converter} from './converter/converter';
|
||||
import {DecToBinConverter} from './converter/dec-to-bin-converter';
|
||||
import {DecToHexConverter} from './converter/dectohexconverter';
|
||||
import {DecToHexConverter} from './converter/dec-to-hex-converter';
|
||||
import {HexToDecConverter} from './converter/hextodecconverter';
|
||||
import {HTMLEntitiesDecoder} from './converter/htmlentitiesdecoder';
|
||||
import {HTMLEntitiesEncoder} from './converter/htmlentitiesencoder';
|
||||
|
|
|
@ -4,7 +4,7 @@ describe('BinToDecConverter', () => {
|
|||
it('should create an instance', () => {
|
||||
expect(new BinToDecConverter()).toBeTruthy();
|
||||
});
|
||||
it('should have the id "base64encode"', () => {
|
||||
it('should have the id "bintodec"', () => {
|
||||
expect(new BinToDecConverter().getId()).toEqual('bintodec');
|
||||
});
|
||||
it('should convert "11011" to "27"', () => {
|
||||
|
|
|
@ -4,7 +4,7 @@ describe('DecToBinConverter', () => {
|
|||
it('should create an instance', () => {
|
||||
expect(new DecToBinConverter()).toBeTruthy();
|
||||
});
|
||||
it('should have the id "base64encode"', () => {
|
||||
it('should have the id "dectobin"', () => {
|
||||
expect(new DecToBinConverter().getId()).toEqual('dectobin');
|
||||
});
|
||||
it('should convert "22" to "10110"', () => {
|
||||
|
|
16
src/app/converter/dec-to-hex-converter.spec.ts
Normal file
16
src/app/converter/dec-to-hex-converter.spec.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
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.');
|
||||
});
|
||||
});
|
Loading…
Reference in a new issue