import 'package:actors/actors.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mews/application/actors/fetch_actor.dart'; const page = ''' Parsed

Some content.

'''; void main() { test('ParseSource parses without touching the network', () async { final actor = Actor.create(FetchHandler.new); addTearDown(actor.close); final result = await actor .send(const ParseSource(url: 'https://example.com/parsed.html', source: page)); expect(result, isA()); final ok = result as FetchPageOk; expect(ok.page.title, 'Parsed'); expect(ok.page.isMews, isTrue); expect(ok.notModified, isFalse); }); test('ParseSource reports broken markup with its source', () async { final actor = Actor.create(FetchHandler.new); addTearDown(actor.close); final result = await actor.send( const ParseSource(url: 'https://example.com/broken.html', source: '

nope')); expect(result, isA()); expect((result as FetchParseError).source, '

nope'); }); }