platform/packages/mustache/test/all_test.dart
2024-10-12 18:45:27 -07:00

34 lines
1.1 KiB
Dart

import 'dart:async';
import 'package:protevus_framework/protevus_framework.dart';
import 'package:protevus_mustache/protevus_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!'));
});
}