import 'package:np_api/np_api.dart'; import 'package:test/test.dart'; void main() { group("RecognizeFaceParser", () { group("parse", () { test("empty", _empty); test("unnamed", _unnamed); test("named", _named); }); }); } Future _empty() async { const xml = """ /remote.php/dav/recognize/admin/faces/ HTTP/1.1 200 OK """; final results = await RecognizeFaceParser().parse(xml); expect( results, const [ RecognizeFace(href: "/remote.php/dav/recognize/admin/faces/"), ], ); } Future _unnamed() async { const xml = """ /remote.php/dav/recognize/admin/faces/ HTTP/1.1 200 OK /remote.php/dav/recognize/admin/faces/10/ HTTP/1.1 200 OK """; final results = await RecognizeFaceParser().parse(xml); expect( results, const [ RecognizeFace(href: "/remote.php/dav/recognize/admin/faces/"), RecognizeFace(href: "/remote.php/dav/recognize/admin/faces/10/"), ], ); } Future _named() async { const xml = """ /remote.php/dav/recognize/admin/faces/ HTTP/1.1 200 OK /remote.php/dav/recognize/admin/faces/lovely%20face/ HTTP/1.1 200 OK """; final results = await RecognizeFaceParser().parse(xml); expect( results, const [ RecognizeFace(href: "/remote.php/dav/recognize/admin/faces/"), RecognizeFace(href: "/remote.php/dav/recognize/admin/faces/lovely face/"), ], ); }