diff options
Diffstat (limited to 'js/tests/services/opmlparserSpec.coffee')
-rw-r--r-- | js/tests/services/opmlparserSpec.coffee | 165 |
1 files changed, 0 insertions, 165 deletions
diff --git a/js/tests/services/opmlparserSpec.coffee b/js/tests/services/opmlparserSpec.coffee deleted file mode 100644 index fb2560626..000000000 --- a/js/tests/services/opmlparserSpec.coffee +++ /dev/null @@ -1,165 +0,0 @@ -### - -ownCloud - News - -@author Raghu Nayyar -@copyright 2012 Raghu Nayyar me@iraghu.com - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -License as published by the Free Software Foundation; either -version 3 of the License, or any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU AFFERO GENERAL PUBLIC LICENSE for more details. - -You should have received a copy of the GNU Affero General Public -License along with this library. If not, see <http://www.gnu.org/licenses/>. - - -### - - -describe 'OPMLParser', -> - - beforeEach module 'News' - - beforeEach inject (@OPMLParser) => - @opml = '<?xml version="1.0" ?> - <opml version="1.1"> - <!--Generated by NewsBlur - www.newsblur.com--> - <head> - <title> - NewsBlur Feeds - </title> - <dateCreated> - 2013-03-14 16:44:01.356965 - </dateCreated> - <dateModified> - 2013-03-14 16:44:01.356965 - </dateModified> - </head> - <body> - <outline htmlUrl="http://www.reddit.com/r/tldr/" - text="test_text" type="rss" version="RSS" - xmlUrl="http://www.reddit.com/r/tldr.rss"/> - - <outline htmlUrl="http://news.ycombinator.com" - text="Hacker News 200" title="Hacker News 200" type="rss" - version="RSS" - xmlUrl= - "http://feeds.feedburner.com/hacker-news-feed-200?format=xml"/> - - <outline text="Design" title="Design"> - <outline htmlUrl="http://worrydream.com/" text= - "<div>Bret Victor\'s website</div>" - title="<div>Bret Victor\'s website</div>" - type="rss" - version="RSS" xmlUrl="http://worrydream.com/feed.xml"/> - - <outline htmlUrl="http://www.hylkebons.nl/journal/rss/" text= - "Journal - Hylke Bons" - title="Journal - Hylke Bons" - type="rss" - version="RSS" xmlUrl="http://feeds.feedburner.com/HbonsHome"/> - - <outline htmlUrl="http://afaikblog.wordpress.com" text= - "As far as I know" - title="As far as I know" - type="rss" - version="RSS" xmlUrl="https://afaikblog.wordpress.com/feed/"/> - - <outline htmlUrl="http://informationarchitects.net" text= - "Information Architects" - title="Information Architects" - type="rss" - version="RSS" xmlUrl="http://informationarchitects.net/feed/"/> - - <outline htmlUrl="http://ignorethecode.net" text= - "ignorethecode.net" - title="ignorethecode.net" - type="rss" - version="RSS" - xmlUrl="http://feeds.feedburner.com/IgnoreTheCode"/> - - <outline htmlUrl="http://blogs.gnome.org/mccann" text= - "Push the Button" - title="Push the Button" - type="rss" - version="RSS" xmlUrl="https://blogs.gnome.org/mccann/feed/"/> - - <outline htmlUrl="http://littlebigdetails.com/" text= - "Little Big Details" - title="Little Big Details" - type="rss" - version="RSS" - xmlUrl="http://feeds.feedburner.com/littlebigdetails"/> - - <outline htmlUrl="http://theixdlibrary.com" text= - "The IxD Library" - title="The IxD Library" type="rss" - version="RSS" xmlUrl="http://theixdlibrary.com/feed/"/> - </outline> - - <outline text="Nomadism" title="Nomadism"> - - <outline htmlUrl="http://a-flat.posterous.com" - text="a-flat" title="a-flat" type="rss" - version="RSS" xmlUrl="http://a-flat.posterous.com/rss.xml"/> - - <outline htmlUrl="http://egor.im" - text="egor.im" title="egor.im" type="rss" - version="RSS" xmlUrl="http://feeds.feedburner.com/egorim"/> - - <outline htmlUrl="http://nomadbase.org/" - text="nomadbase - find the others..." - title="nomadbase - find the others..." type="rss" - version="RSS" xmlUrl="http://nomadbase.org/rss.xml"/> - - <outline htmlUrl="http://casarobino.org/frontpage" - text="Casa Robino - Shared Hospitality" - title="Casa Robino - Shared Hospitality" type="rss" - version="RSS" xmlUrl="http://casarobino.org/rss.xml"/> - - <outline htmlUrl="http://casabhavani.org" - text="Casa Bhavani" title="Casa Bhavani" type="rss" - version="RSS" xmlUrl="http://casabhavani.org/feed/"/> - - </outline> - - <outline htmlUrl="http://www.elezea.com" - text="Elezea" title="Elezea" type="rss" - version="RSS" xmlUrl="http://feeds.feedburner.com/elezea"/> - - </body> - </opml>' - @data = @OPMLParser.parseXML(@opml) - - - it 'should return only the root folder when parsing empty OPML', => - data = @OPMLParser.parseXML('') - expect(data.getName()).toBe('root') - - - it 'should parse folders', => - firstLevel = @data.getItems() - expect(firstLevel[2].isFolder()).toBe(true) - expect(firstLevel[2].getName()).toBe('Design') - - - it 'should parse feeds', => - firstLevel = @data.getItems()[0] - expect(firstLevel.isFolder()).toBe(false) - expect(firstLevel.getUrl()).toBe('http://www.reddit.com/r/tldr.rss') - expect(firstLevel.getName()).toBe('test_text') - - - it 'should nest feeds', => - secondLevel = @data.getItems()[2].getItems()[1] - expect(secondLevel.isFolder()).toBe(false) - expect(secondLevel.getUrl()). - toBe('http://feeds.feedburner.com/HbonsHome') - expect(secondLevel.getName()).toBe('Journal - Hylke Bons') - |