add insertion test
This commit is contained in:
parent
db808be825
commit
dbb2487c5c
4 changed files with 39 additions and 9 deletions
|
@ -1,6 +1,27 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'package:angel_orm_postgres/angel_orm_postgres.dart';
|
||||
import 'package:angel_orm_test/angel_orm_test.dart';
|
||||
import 'package:postgres/postgres.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
void main() {
|
||||
PostgreSQLConnection _connect() {
|
||||
return PostgreSQLConnection('localhost', 5432, 'angel_orm_test');
|
||||
}
|
||||
|
||||
group('single', () {
|
||||
PostgreSqlExecutor executor;
|
||||
PostgreSQLConnection c = _connect();
|
||||
|
||||
setUp(() async {
|
||||
var c = _connect();
|
||||
await c.open();
|
||||
executor = PostgreSqlExecutor(c);
|
||||
});
|
||||
|
||||
tearDown(() => executor.close());
|
||||
|
||||
ormTests(() => executor);
|
||||
});
|
||||
}
|
|
@ -2,8 +2,6 @@ import 'package:angel_orm/angel_orm.dart';
|
|||
import 'package:test/test.dart';
|
||||
import 'standalone.dart';
|
||||
|
||||
void Function() ormTests(QueryExecutor executor) {
|
||||
return () {
|
||||
void ormTests(QueryExecutor Function() executor) {
|
||||
group('standalone', standaloneTests(executor));
|
||||
};
|
||||
}
|
|
@ -2,6 +2,16 @@ import 'package:angel_orm/angel_orm.dart';
|
|||
import 'package:angel_orm_test/angel_orm_test.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
void Function() standaloneTests(QueryExecutor executor) {
|
||||
return () {};
|
||||
void Function() standaloneTests(QueryExecutor Function() executorFn) {
|
||||
return () {
|
||||
test('insert one', () async {
|
||||
var executor = executorFn();
|
||||
var query = TodoQuery();
|
||||
query.values
|
||||
..isComplete = false
|
||||
..text = 'Clean your dirty room';
|
||||
var todo = await query.insert(executor);
|
||||
print(todo.toJson());
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ dependencies:
|
|||
angel_migration: ^2.0.0-alpha
|
||||
angel_model: ^1.0.0
|
||||
angel_orm: ^2.0.0-dev
|
||||
angel_serialize: ^2.0.0
|
||||
test: ^1.0.0
|
||||
dev_dependencies:
|
||||
angel_orm_generator:
|
||||
|
|
Loading…
Reference in a new issue