34 lines
1 KiB
Dart
34 lines
1 KiB
Dart
import 'dart:async';
|
|
import 'package:angel3_framework/angel3_framework.dart';
|
|
import 'package:angel3_mustache/angel3_mustache.dart';
|
|
import 'package:file/file.dart';
|
|
import 'package:file/local.dart';
|
|
import 'package:test/test.dart';
|
|
|
|
void main() async {
|
|
var protevus = Protevus();
|
|
await protevus
|
|
.configure(mustache(const LocalFileSystem().directory('./test')));
|
|
|
|
test('can render templates', () async {
|
|
var hello = await protevus.viewGenerator!('hello', {'name': 'world'});
|
|
var bar =
|
|
await protevus.viewGenerator!('foo/bar', {'framework': 'protevus'});
|
|
|
|
expect(hello, equals('Hello, world!'));
|
|
expect(bar, equals('angel_framework'));
|
|
});
|
|
|
|
test('throws if view is not found', () {
|
|
expect(Future(() async {
|
|
var fails =
|
|
await protevus.viewGenerator!('fail', {'this_should': 'fail'});
|
|
print(fails);
|
|
}), throwsA(isA<FileSystemException>()));
|
|
});
|
|
|
|
test('partials', () async {
|
|
var withPartial = await protevus.viewGenerator!('with-partial');
|
|
expect(withPartial, equals('Hello, world!'));
|
|
});
|
|
}
|