Skip to content
This repository has been archived by the owner on May 7, 2023. It is now read-only.

Commit

Permalink
Improve SelectBloc tests
Browse files Browse the repository at this point in the history
  • Loading branch information
synw committed Oct 15, 2019
1 parent 2d1f8c9 commit 4f63049
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 50 deletions.
95 changes: 47 additions & 48 deletions coverage/lcov.info
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ DA:19,0
DA:20,0
DA:21,0
DA:43,0
DA:47,0
DA:47,3
DA:50,0
DA:53,0
DA:56,4
Expand Down Expand Up @@ -264,7 +264,7 @@ DA:749,1
DA:751,0
DA:752,0
LF:264
LH:189
LH:190
end_of_record
SF:lib/src/bloc_select.dart
DA:19,1
Expand All @@ -274,23 +274,23 @@ DA:34,2
DA:35,0
DA:39,1
DA:40,1
DA:41,0
DA:41,4
DA:42,0
DA:43,0
DA:44,0
DA:46,0
DA:47,0
DA:98,3
DA:102,0
DA:103,0
DA:107,0
DA:108,0
DA:109,0
DA:110,0
DA:111,0
DA:102,1
DA:103,3
DA:107,1
DA:108,2
DA:109,1
DA:110,2
DA:111,1
DA:115,1
DA:119,1
DA:120,0
DA:120,5
DA:121,1
DA:122,3
DA:123,1
Expand All @@ -315,7 +315,7 @@ DA:144,0
DA:151,1
DA:152,3
LF:47
LH:29
LH:38
end_of_record
SF:lib/src/models.dart
DA:4,3
Expand Down Expand Up @@ -435,49 +435,48 @@ DA:260,1
DA:261,2
DA:262,2
DA:263,3
DA:265,1
DA:270,1
DA:277,1
DA:279,0
DA:282,1
DA:285,0
DA:288,0
DA:290,2
DA:291,3
DA:295,1
DA:264,1
DA:268,1
DA:275,1
DA:277,0
DA:280,1
DA:283,0
DA:286,0
DA:288,2
DA:289,3
DA:293,1
DA:299,1
DA:301,1
DA:303,1
DA:304,2
DA:305,1
DA:306,2
DA:302,2
DA:303,3
DA:307,0
DA:308,0
DA:309,0
DA:310,0
DA:311,0
DA:312,0
DA:313,0
DA:315,0
DA:316,0
DA:317,0
DA:318,0
DA:319,0
DA:320,0
DA:321,0
DA:325,0
DA:326,0
DA:329,2
DA:330,4
DA:322,0
DA:323,0
DA:326,2
DA:327,4
DA:328,6
DA:329,4
DA:330,2
DA:331,6
DA:332,4
DA:333,2
DA:334,6
DA:336,2
DA:340,2
DA:341,8
DA:337,2
DA:338,8
DA:342,2
DA:343,2
DA:344,6
DA:345,2
DA:346,2
DA:347,6
DA:348,2
DA:349,2
DA:355,1
DA:356,1
LF:123
LH:91
DA:352,1
DA:353,1
LF:122
LH:90
end_of_record
SF:lib/src/schema/models/column.dart
DA:5,4
Expand Down
20 changes: 18 additions & 2 deletions test/db_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,25 @@ void main() async {

group("Select bloc", () {
test("init", () async {
final bloc = SelectBloc(database: db, table: "test");
final bloc = SelectBloc(database: db, reactive: true, table: "test");
var i = 0;
bloc.items.listen((item) {
//print("ITEM $item");
expect(item, <Map<String, dynamic>>[
<String, dynamic>{"k": "v"},
<String, dynamic>{"k": "v"}
]);
if (i > 0) {
// update finished, dispose
bloc.dispose();
}
++i;
});
bloc.update(<Map<String, dynamic>>[
<String, dynamic>{"k": "v"},
<String, dynamic>{"k": "v"}
]);
final bloc2 = SelectBloc(database: db, query: "SELECT * FROM test");
bloc2.items.listen((item) {
expect(item, <Map<String, dynamic>>[
<String, dynamic>{"k": "v"},
<String, dynamic>{"k": "v"}
Expand Down

0 comments on commit 4f63049

Please sign in to comment.