Fix naming, add tests #5
3 changed files with 26 additions and 2 deletions
|
@ -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';
|
||||
|
|
24
src/app/converter/rot13-converter.spec.ts
Normal file
24
src/app/converter/rot13-converter.spec.ts
Normal 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);
|
||||
});
|
||||
});
|
|
@ -6,7 +6,7 @@ export class ROT13Converter implements Converter {
|
|||
}
|
||||
|
||||
getId(): string {
|
||||
return 'rot13convert';
|
||||
return 'rot13';
|
||||
}
|
||||
|
||||
convert(input: string): string {
|
Loading…
Reference in a new issue