converter/src/app/converter/htmlentities-decoder.spec.ts

25 lines
747 B
TypeScript

import {HTMLEntitiesDecoder} from './htmlentities-decoder';
describe('HTMLEntitiesDecoder', () => {
let sut: HTMLEntitiesDecoder;
beforeEach(() => sut = new HTMLEntitiesDecoder());
it('should create an instance', () => {
expect(sut).toBeTruthy();
});
it('should have a display name', () => {
expect(sut.getDisplayname()).toBeTruthy();
});
it('should have the id "decodehtmlentities"', () => {
expect(sut.getId()).toEqual('decodehtmlentities');
});
it('should decode "&lt;span&gt;&quot;Hi&quot; &amp; &quot;Lo&quot;&lt;/span&gt;" to "<span>"Hi" & "Lo"</span>"', () => {
expect(sut.convert('&lt;span&gt;&quot;Hi&quot; &amp; &quot;Lo&quot;&lt;/span&gt;'))
.toEqual('<span>"Hi" & "Lo"</span>');
});
});