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

25 lines
747 B
TypeScript

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