Added tests for URI{De,En}coder.
This commit is contained in:
parent
626b3b4655
commit
d1dde13bef
2 changed files with 42 additions and 0 deletions
21
src/app/converter/uridecoder.spec.ts
Normal file
21
src/app/converter/uridecoder.spec.ts
Normal file
|
@ -0,0 +1,21 @@
|
|||
import {URIDecoder} from './uridecoder';
|
||||
|
||||
describe('URIDecoder', () => {
|
||||
let sut: URIDecoder;
|
||||
|
||||
beforeEach(() => sut = new URIDecoder());
|
||||
|
||||
it('should create an instance', () => {
|
||||
expect(sut).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should have the id "uridecode"', () => {
|
||||
expect(sut.getId()).toEqual('uridecode');
|
||||
});
|
||||
|
||||
it('should decode "http://m%C3%A4nu:gh%C3%ABim@host:port/hi.there?oh=well#ya" ' +
|
||||
'to "http://mänu:ghëim@host:port/hi.there?oh=well#ya"', () => {
|
||||
expect(sut.convert('http://m%C3%A4nu:gh%C3%ABim@host:port/hi.there?oh=well#ya'))
|
||||
.toEqual('http://mänu:ghëim@host:port/hi.there?oh=well#ya');
|
||||
});
|
||||
});
|
21
src/app/converter/uriencoder.spec.ts
Normal file
21
src/app/converter/uriencoder.spec.ts
Normal file
|
@ -0,0 +1,21 @@
|
|||
import {URIEncoder} from './uriencoder';
|
||||
|
||||
describe('URIEncoder', () => {
|
||||
let sut: URIEncoder;
|
||||
|
||||
beforeEach(() => sut = new URIEncoder());
|
||||
|
||||
it('should create an instance', () => {
|
||||
expect(sut).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should have the id "uriencode"', () => {
|
||||
expect(sut.getId()).toEqual('uriencode');
|
||||
});
|
||||
|
||||
it('should encode "http://mänu:ghëim@host:port/hi.there?oh=well#ya" ' +
|
||||
'to "http://m%C3%A4nu:gh%C3%ABim@host:port/hi.there?oh=well#ya"', () => {
|
||||
expect(sut.convert('http://mänu:ghëim@host:port/hi.there?oh=well#ya'))
|
||||
.toEqual('http://m%C3%A4nu:gh%C3%ABim@host:port/hi.there?oh=well#ya');
|
||||
});
|
||||
});
|
Loading…
Reference in a new issue