Fix naming, add tests #5

Merged
manuel merged 19 commits from feature/use-proper-dirstructure into develop 2018-09-01 01:34:35 +02:00
3 changed files with 26 additions and 2 deletions
Showing only changes of commit fee4622044 - Show all commits

View file

@ -13,7 +13,7 @@ import {PunycodeDecoder} from './converter/punycode-decoder';
import {PunycodeEncoder} from './converter/punycode-encoder';
import {QuotedPrintableDecoder} from './converter/quoted-printable-decoder';
import {QuotedPrintableEncoder} from './converter/quoted-printable-encoder';
import {ROT13Converter} from './converter/rot13converter';
import {ROT13Converter} from './converter/rot13-converter';
import {URIComponentDecoder} from './converter/uricomponentdecoder';
import {URIComponentEncoder} from './converter/uricomponentencoder';
import {URIDecoder} from './converter/uridecoder';

View file

@ -0,0 +1,24 @@
import {ROT13Converter} from './rot13-converter';
describe('ROT13Converter', () => {
let sut: ROT13Converter;
beforeEach(() => sut = new ROT13Converter());
it('should create an instance', () => {
expect(sut).toBeTruthy();
});
it('should have the id "rot13"', () => {
expect(sut.getId()).toEqual('rot13');
});
it('should encode "Hello, World!" to "Uryyb, Jbeyq!"', () => {
expect(sut.convert('Hello, World!')).toEqual('Uryyb, Jbeyq!');
});
it('should return the original input after being applied twice', () => {
const input = 'Ok, so this string is just a bunch of letters. And numbers: 1, 2, 3. Ans others: /&%. Kthxbye!';
expect(sut.convert(sut.convert(input))).toEqual(input);
});
});

View file

@ -6,7 +6,7 @@ export class ROT13Converter implements Converter {
}
getId(): string {
return 'rot13convert';
return 'rot13';
}
convert(input: string): string {