blob: 2b14558cf2efaf3ba21aaa19e3af5475b33f7ee5 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
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('');
});
});
});
|