Fixed URIComponent{De,En}coder file names and added tests.
This commit is contained in:
parent
fee4622044
commit
626b3b4655
5 changed files with 44 additions and 2 deletions
|
@ -14,8 +14,8 @@ import {PunycodeEncoder} from './converter/punycode-encoder';
|
|||
import {QuotedPrintableDecoder} from './converter/quoted-printable-decoder';
|
||||
import {QuotedPrintableEncoder} from './converter/quoted-printable-encoder';
|
||||
import {ROT13Converter} from './converter/rot13-converter';
|
||||
import {URIComponentDecoder} from './converter/uricomponentdecoder';
|
||||
import {URIComponentEncoder} from './converter/uricomponentencoder';
|
||||
import {URIComponentDecoder} from './converter/uricomponent-decoder';
|
||||
import {URIComponentEncoder} from './converter/uricomponent-encoder';
|
||||
import {URIDecoder} from './converter/uridecoder';
|
||||
import {URIEncoder} from './converter/uriencoder';
|
||||
import {UTF8Decoder} from './converter/utf8decoder';
|
||||
|
|
21
src/app/converter/uricomponent-decoder.spec.ts
Normal file
21
src/app/converter/uricomponent-decoder.spec.ts
Normal file
|
@ -0,0 +1,21 @@
|
|||
import {URIComponentDecoder} from './uricomponent-decoder';
|
||||
|
||||
describe('URIComponentDecoder', () => {
|
||||
let sut: URIComponentDecoder;
|
||||
|
||||
beforeEach(() => sut = new URIComponentDecoder());
|
||||
|
||||
it('should create an instance', () => {
|
||||
expect(sut).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should have the id "uricomponentdecode"', () => {
|
||||
expect(sut.getId()).toEqual('uricomponentdecode');
|
||||
});
|
||||
|
||||
it('should decode "http%3A%2F%2Fm%C3%A4nu%3Agh%C3%ABim%40host%3Aport%2Fhi.there%3Foh%3Dwell%23ya" ' +
|
||||
'to "http://mänu:ghëim@host:port/hi.there?oh=well#ya"', () => {
|
||||
expect(sut.convert('http%3A%2F%2Fm%C3%A4nu%3Agh%C3%ABim%40host%3Aport%2Fhi.there%3Foh%3Dwell%23ya'))
|
||||
.toEqual('http://mänu:ghëim@host:port/hi.there?oh=well#ya');
|
||||
});
|
||||
});
|
21
src/app/converter/uricomponent-encoder.spec.ts
Normal file
21
src/app/converter/uricomponent-encoder.spec.ts
Normal file
|
@ -0,0 +1,21 @@
|
|||
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 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');
|
||||
});
|
||||
});
|
Loading…
Reference in a new issue