/** * ownCloud - News * * This file is licensed under the Affero General Public License version 3 or * later. See the COPYING file. * * @author Bernhard Posselt * @copyright Bernhard Posselt 2014 */ describe('OPMLParser', function () { 'use strict'; var result; /*jshint multistr: true */ /*jshint quotmark: double */ var xml = " \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "; /*jshint quotmark: single */ beforeEach(module('News')); beforeEach(inject(function (OPMLParser) { result = OPMLParser.parse(xml); })); it ('should parse the correct amount of feeds and folders', function () { expect(result.folders.length).toBe(2); expect(result.feeds.length).toBe(2); expect(result.folders[0].feeds.length).toBe(3); expect(result.folders[1].feeds.length).toBe(1); }); it ('should default to title for feeds and folders', function () { expect(result.folders[0].name).toBe('Tesign'); expect(result.folders[1].name).toBe('Nomadism'); expect(result.feeds[0].name).toBe('test_text'); expect(result.feeds[1].name).toBe('Elezea'); }); it ('should default to url for feeds if no title or text', function () { expect(result.folders[0].feeds[0].name).toBe('man'); expect(result.folders[0].feeds[1].name).toBe( 'http://afaikblog.wordpress.com'); expect(result.folders[0].feeds[2].name).toBe( 'http://informationarchitects.net/feed/'); }); });