import 'package:flutter_test/flutter_test.dart';
import 'package:proxypin/network/http/content_type.dart';
import 'package:proxypin/network/http/http.dart';
import 'package:proxypin/utils/html_formatter.dart';
void main() {
test('HTML.pretty formats nested markup', () {
const input = '
';
expect(
HTML.pretty(input),
'\n'
'
Hello
\n'
'
\n'
' World\n'
' !\n'
'
\n'
'
',
);
});
test('HTML.pretty tolerates malformed HTML', () {
const input = 'hello
';
expect(
HTML.pretty(input),
'\n'
' hello\n'
'
',
);
});
test('HTML.pretty leaves plain text unchanged', () {
expect(HTML.pretty('plain text body'), 'plain text body');
});
test('xhtml content type maps to html', () {
final response = HttpResponse(HttpStatus.ok);
response.headers.set('content-type', 'application/xhtml+xml; charset=utf-8');
expect(response.contentType, ContentType.html);
});
}