import 'package:moxxmpp/moxxmpp.dart';
import 'package:test/test.dart';
import 'package:xml/xml.dart';
import 'helpers/xml.dart';
void main() {
test('Test stringxml', () {
final child = XMLNode(tag: 'uwu', attributes: { 'strength': 10 });
final stanza = XMLNode.xmlns(tag: 'uwu-meter', xmlns: 'uwu', children: [ child ]);
expect(XMLNode(tag: 'iq', attributes: {'xmlns': 'uwu'}).toXml(), "");
expect(XMLNode.xmlns(tag: 'iq', xmlns: 'uwu', attributes: {'how': 'uwu'}).toXml(), "");
expect(stanza.toXml(), "");
expect(StreamHeaderNonza('uwu.server').toXml(), "");
expect(XMLNode(tag: 'text', attributes: {}, text: 'hallo').toXml(), 'hallo');
expect(XMLNode(tag: 'text', attributes: { 'world': 'no' }, text: 'hallo').toXml(), "hallo");
expect(XMLNode(tag: 'text', attributes: {}, text: 'hallo').toXml(), 'hallo');
expect(XMLNode(tag: 'text', attributes: {}, text: 'test').innerText(), 'test');
});
test('Test XmlElement', () {
expect(XMLNode.fromXmlElement(XmlDocument.parse("").firstElementChild!).toXml(), "");
});
test('Test the find functions', () {
final node1 = XMLNode.fromString('Hallo');
expect(compareXMLNodes(node1.firstTag('body')!, XMLNode.fromString('Hallo')), true);
expect(compareXMLNodes(node1.firstTagByXmlns('a')!, XMLNode.fromString('')), true);
});
}