21-atom.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. (function () {
  2. function RunningInNode () {
  3. return(
  4. (typeof require) == "function"
  5. &&
  6. (typeof exports) == "object"
  7. &&
  8. (typeof module) == "object"
  9. &&
  10. (typeof __filename) == "string"
  11. &&
  12. (typeof __dirname) == "string"
  13. );
  14. }
  15. if (!RunningInNode()) {
  16. if (!this.Tautologistics)
  17. this.Tautologistics = {};
  18. if (!this.Tautologistics.NodeHtmlParser)
  19. this.Tautologistics.NodeHtmlParser = {};
  20. if (!this.Tautologistics.NodeHtmlParser.Tests)
  21. this.Tautologistics.NodeHtmlParser.Tests = [];
  22. exports = {};
  23. this.Tautologistics.NodeHtmlParser.Tests.push(exports);
  24. }
  25. exports.name = "Atom (1.0)";
  26. exports.options = {
  27. handler: {}
  28. , parser: {}
  29. };
  30. exports.type = "rss";
  31. //http://en.wikipedia.org/wiki/Atom_%28standard%29
  32. exports.html = '<?xml version="1.0" encoding="utf-8"?>\
  33. \
  34. <feed xmlns="http://www.w3.org/2005/Atom">\
  35. \
  36. <title>Example Feed</title>\
  37. <subtitle>A subtitle.</subtitle>\
  38. <link href="http://example.org/feed/" rel="self" />\
  39. <link href="http://example.org/" />\
  40. <id>urn:uuid:60a76c80-d399-11d9-b91C-0003939e0af6</id>\
  41. <updated>2003-12-13T18:30:02Z</updated>\
  42. <author>\
  43. <name>John Doe</name>\
  44. <email>johndoe@example.com</email>\
  45. </author>\
  46. \
  47. <entry>\
  48. <title>Atom-Powered Robots Run Amok</title>\
  49. <link href="http://example.org/2003/12/13/atom03" />\
  50. <link rel="alternate" type="text/html" href="http://example.org/2003/12/13/atom03.html"/>\
  51. <link rel="edit" href="http://example.org/2003/12/13/atom03/edit"/>\
  52. <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>\
  53. <updated>2003-12-13T18:30:02Z</updated>\
  54. <summary>Some text.</summary>\
  55. </entry>\
  56. \
  57. </feed>';
  58. exports.expected = {
  59. type: "atom"
  60. , id: "urn:uuid:60a76c80-d399-11d9-b91C-0003939e0af6"
  61. , title: "Example Feed"
  62. , link: "http://example.org/feed/"
  63. , description: "A subtitle."
  64. , updated: new Date("2003-12-13T18:30:02Z")
  65. , author: "johndoe@example.com"
  66. , items: [
  67. {
  68. id: "urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a"
  69. , title: "Atom-Powered Robots Run Amok"
  70. , link: "http://example.org/2003/12/13/atom03"
  71. , description: "Some text."
  72. , pubDate: new Date("2003-12-13T18:30:02Z")
  73. }
  74. ]
  75. };
  76. })();