mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-10-23 04:52:14 +00:00
* feat(new tool): xml formatter * feat(xml-formatter): added happy path e2e tests * refactor(xml-formatter): improved unit tests * refactor(xml-formatter): add better suitable icon * feat(xml-formatter): added happy path e2e tests * feat(xml-formatter): registered xml as syntax highlighter * chore(auto-import): removed unused NSpace --------- Co-authored-by: Corentin Thomasset <corentin.thomasset74@gmail.com>
28 lines
732 B
TypeScript
28 lines
732 B
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { formatXml } from './xml-formatter.service';
|
|
|
|
describe('xml-formatter service', () => {
|
|
describe('formatXml', () => {
|
|
it('converts XML into a human readable format', () => {
|
|
const initString = '<hello><world>foo</world><world>bar</world></hello>';
|
|
|
|
expect(formatXml(initString)).toMatchInlineSnapshot(`
|
|
"<hello>
|
|
<world>
|
|
foo
|
|
</world>
|
|
<world>
|
|
bar
|
|
</world>
|
|
</hello>"
|
|
`);
|
|
});
|
|
|
|
it('returns an empty string if the input is not valid XML', () => {
|
|
const initString = 'hello world';
|
|
|
|
expect(formatXml(initString)).toEqual('');
|
|
});
|
|
});
|
|
});
|