converter/src/app/converter/uricomponent-encoder.spec.ts

26 lines
840 B
TypeScript

import {URIComponentEncoder} from './uricomponent-encoder';
describe('URIComponentEncoder', () => {
let sut: URIComponentEncoder;
beforeEach(() => sut = new URIComponentEncoder());
it('should create an instance', () => {
expect(sut).toBeTruthy();
});
it('should have a display name', () => {
expect(sut.getDisplayname()).toBeTruthy();
});
it('should have the id "uricomponentencode"', () => {
expect(sut.getId()).toEqual('uricomponentencode');
});
it('should encode "http://mänu:ghëim@host:port/hi.there?oh=well#ya" ' +
'to "http%3A%2F%2Fm%C3%A4nu%3Agh%C3%ABim%40host%3Aport%2Fhi.there%3Foh%3Dwell%23ya"', () => {
expect(sut.convert('http://mänu:ghëim@host:port/hi.there?oh=well#ya'))
.toEqual('http%3A%2F%2Fm%C3%A4nu%3Agh%C3%ABim%40host%3Aport%2Fhi.there%3Foh%3Dwell%23ya');
});
});