mirror of
https://github.com/iib0011/omni-tools.git
synced 2025-12-29 16:16:02 +00:00
feat(xml): add XML tools for validation, beautification, and viewing
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import { expect, describe, it } from 'vitest';
|
||||
import { beautifyXml } from './service';
|
||||
|
||||
describe('xml-beautifier', () => {
|
||||
it('beautifies valid XML', () => {
|
||||
const input = '<root><a>1</a><b>2</b></root>';
|
||||
const result = beautifyXml(input, {});
|
||||
expect(result).toContain('<root>');
|
||||
expect(result).toContain(' <a>1</a>');
|
||||
expect(result).toContain(' <b>2</b>');
|
||||
});
|
||||
|
||||
it('returns error for invalid XML', () => {
|
||||
const input = '<root><a>1</b></root>';
|
||||
const result = beautifyXml(input, {});
|
||||
expect(result).toMatch(/Invalid XML/i);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user