Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Commit

Permalink
#19. Fixing test
Browse files Browse the repository at this point in the history
  • Loading branch information
matei-tm committed Apr 2, 2019
1 parent d4a0c57 commit 845444c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/lib/generator/writers/proxy_writer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ class ProxyWriter extends EntityWriter {
class ${emittedEntity.modelName}Proxy extends ${emittedEntity.modelName} {
Map<String, dynamic> toMap() {
var map = new Map<String, dynamic>();
${this._getToMapList()}
${this._getToMapList()}
return map;
}
${emittedEntity.modelName}Proxy.fromMap(Map<String, dynamic> map) {
${this._getFromMapList()}
${this._getFromMapList()}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_sqlite_m8_generator
description: Flutter package to generate SQLite fixture in conjuction with the package flutter_orm_m8.
version: 0.0.5
version: 0.0.6
author: Mircea-Tiberiu MATEI<[email protected]>
homepage: https://github.com/matei-tm/flutter-sqlite-m8-generator

Expand Down
30 changes: 20 additions & 10 deletions src/test/flutter_sqlite_m8_generator_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,22 @@ import 'dart:async';
/*import 'package:todo_currentProjectPackage_path/abstract_database_helper.dart';*/
import 'package:__test__/account_related.dart';
class HealthEntryAccountRelatedProxy extends HealthEntryAccountRelated {
Map<String, dynamic> toMap() {
var map = new Map<String, dynamic>();
map['my_id_column'] = id;
map['my_description_column'] = description;
map['my_account_id_column'] = accountId;
return map;
}
HealthEntryAccountRelatedProxy.fromMap(Map<String, dynamic> map) {
this.id = map['my_id_column'];
this.description = map['my_description_column'];
this.accountId = map['my_account_id_column'];
}
}
mixin HealthEntryAccountRelatedDatabaseHelper /*implements AbstractDatabaseHelper*/ {
Future<Database> db;
final theHealthEntryAccountRelatedColumns = ["my_id_column", "my_description_column", "my_account_id_column"];
Expand All @@ -31,7 +47,7 @@ mixin HealthEntryAccountRelatedDatabaseHelper /*implements AbstractDatabaseHelpe
await db.execute('CREATE TABLE $_theHealthEntryAccountRelatedTableHandler (my_id_column INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE, my_description_column TEXT UNIQUE, my_account_id_column INTEGER NOT NULL)');
}
Future<int> saveHealthEntryAccountRelated(HealthEntryAccountRelated instanceHealthEntryAccountRelated) async {
Future<int> saveHealthEntryAccountRelated(HealthEntryAccountRelatedProxy instanceHealthEntryAccountRelated) async {
var dbClient = await db;
var result = await dbClient.insert(_theHealthEntryAccountRelatedTableHandler, instanceHealthEntryAccountRelated.toMap());
return result;
Expand Down Expand Up @@ -66,11 +82,9 @@ var dbClient = await db;
List<Map> result = await dbClient.query(_theHealthEntryAccountRelatedTableHandler,
columns: theHealthEntryAccountRelatedColumns, where: 'my_id_column = ? AND is_deleted != 1', whereArgs: [id]);
/*
if (result.length > 0) {
return HealthEntryAccountRelated.fromMap(result.first);
return HealthEntryAccountRelatedProxy.fromMap(result.first);
}
*/
return null;
}
Expand All @@ -87,7 +101,7 @@ await dbClient.delete(_theHealthEntryAccountRelatedTableHandler);
return true;
}
Future<int> updateHealthEntryAccountRelated(HealthEntryAccountRelated instanceHealthEntryAccountRelated) async {
Future<int> updateHealthEntryAccountRelated(HealthEntryAccountRelatedProxy instanceHealthEntryAccountRelated) async {
var dbClient = await db;
return await dbClient.update(_theHealthEntryAccountRelatedTableHandler, instanceHealthEntryAccountRelated.toMap(),
where: "my_id_column = ?", whereArgs: [instanceHealthEntryAccountRelated.id]);
Expand All @@ -102,11 +116,7 @@ map['is_deleted'] = 1;
return await dbClient
.update(_theHealthEntryAccountRelatedTableHandler, map, where: "my_id_column = ?", whereArgs: [id]);
}
}
// Entity:my_account_related_table Model:HealthEntryAccountRelated
//{_id: Instance of 'EntityAttribute', _description: Instance of 'EntityAttribute', _accountId: Instance of 'EntityAttribute'}''';
}''';
expect(output, expected);
});

Expand Down

0 comments on commit 845444c

Please sign in to comment.