import 'dart:async'; import 'dart:convert'; import 'dart:io'; import 'package:angel_framework/angel_framework.dart'; import 'package:angel_static/angel_static.dart'; import 'package:angel_test/angel_test.dart'; import 'package:mustache4dart/mustache4dart.dart' as ms; import 'package:test/test.dart'; main() { TestClient client, client2; setUp(() async { var app = new Angel(); var vDir = new CachingVirtualDirectory( source: new Directory('test'), transformers: [new ExtensionTransformer()]); await app.configure(vDir); await vDir.transformersLoaded.then((map) { print('Loaded transformer map: $map'); }); client = await connectTo(app); var app2 = new Angel(); var vDir2 = new CachingVirtualDirectory( source: new Directory('test'), transformers: [ new MustacheTransformer({'foo': 'bar'}) ]); await app2.configure(vDir2); await vDir2.transformersLoaded.then((map) { print('Loaded transformer map2: $map'); }); client2 = await connectTo(app2); }); tearDown(() => client.close().then((_) => client2.close())); test('foo', () async { var response = await client.get('/index.ext'); print('Response: ${response.body}'); expect(response, hasBody('.txt')); }); test('request twice in a row', () async { var response = await client2.get('/foo.html'); print('Response: ${response.body}'); print('Response headers: ${response.headers}'); expect(response, hasBody('