The Webfeed Flutter package for Appeto SDK.
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

44 rindas
1.6 KiB

  1. import 'dart:io';
  2. import 'dart:core';
  3. import 'package:test/test.dart';
  4. import 'package:webfeedclient/domain/channel.dart';
  5. import 'package:xml/xml.dart' as xml;
  6. void main() {
  7. test("parsing Invalid.xml", () {
  8. var xmlString = new File("test/examples/Invalid.xml").readAsStringSync();
  9. var doc = xml.parse(xmlString);
  10. try {
  11. new Channel.parse(doc);
  12. fail("Should throw Argument Error");
  13. } on ArgumentError {}
  14. });
  15. test("parsing RSS.xml", () {
  16. var xmlString = new File("test/examples/RSS.xml").readAsStringSync();
  17. var doc = xml.parse(xmlString);
  18. var channel = new Channel.parse(doc);
  19. expect(channel.title, "News - Foo bar News");
  20. expect(channel.description, "Foo bar News and Updates feed provided by Foo bar, Inc.");
  21. expect(channel.link, "https://foo.bar.news/");
  22. expect(channel.language, "en-US");
  23. expect(channel.lastBuildDate, "Mon, 26 Mar 2018 14:00:00 PDT");
  24. expect(channel.generator, "Custom");
  25. expect(channel.copyright, "Copyright 2018, Foo bar Inc.");
  26. expect(channel.image.title, "Foo bar News");
  27. expect(channel.image.url, "https://foo.bar.news/logo.gif");
  28. expect(channel.image.link, "https://foo.bar.news/");
  29. expect(channel.items.length, 2);
  30. expect(channel.items.first.title, "The standard Lorem Ipsum passage, used since the 1500s");
  31. expect(channel.items.first.description, "Lorem ipsum dolor sit amet, consectetur adipiscing elit");
  32. expect(channel.items.first.link, "https://foo.bar.news/1");
  33. expect(channel.items.first.guid, "https://foo.bar.news/1?guid");
  34. expect(channel.items.first.pubDate, "Mon, 26 Mar 2018 14:00:00 PDT");
  35. });
  36. }