use Test::More tests => 4;
use strict;
use warnings;
use_ok( 'XML::Atom::Feed::JavaScript' );
my $feed = XML::Atom::Feed::JavaScript->new(Stream => 't/feed.xml');
my $expected = <<'JAVASCRIPT_TEXT';
document.write('
');
document.write('
dive into atom
');
document.write('
');
document.write('- Test
Python is cool stuff for ReSTy webapps.
');
document.write('- Created using the Fix Auth Stuff.
');
document.write('- just a test - updated nothing to see here, move along
');
document.write('- Second attempt.
Updating now works too.
How about a new paragraph?
');
document.write('- First post. Testing a javascript client. Test. Again. and again.
');
document.write('- Can anyone post? Is it OK for other people to post to this test implementation?
It works! Yes! for now ');
document.write('- Unit Test 1 When you do unit testing.
');
document.write('- Unit Test 1 When you do unit testing.
');
document.write('- Unit Test 1 When you do unit testing.
');
document.write('- Unit Test 1 When you do unit testing.
');
document.write('- Unit Test 1 When you do unit testing.
');
document.write('- Unit Test 1 When you do unit testing.
');
document.write('- Unit Test 1 When you do unit testing.
');
document.write('- Unit Test 1 When you do unit testing.
');
document.write('- Unit Test 1 When you do unit testing.
');
document.write('
');
document.write('
');
JAVASCRIPT_TEXT
my $expected_max = <<'JAVASCRIPT_TEXT';
document.write('');
document.write('
dive into atom
');
document.write('
');
document.write('- Test
Python is cool stuff for ReSTy webapps.
');
document.write('
');
document.write('
');
JAVASCRIPT_TEXT
is( $feed->asJavascript(), $expected, 'asJavascript' );
is( $feed->asJavascript( 1 ), $expected_max, 'asJavascript( max )' );
is( $feed->asJavascript( 20 ), $expected, 'asJavascript( max too big )' );