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 a display name', () => {
    expect(sut.getDisplayname()).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);
  });
});