Skip to content

Commit

Permalink
Add more tests to DatabaseBloc
Browse files Browse the repository at this point in the history
  • Loading branch information
Syutkin committed Jan 23, 2025
1 parent 52bd28d commit 27fa75d
Show file tree
Hide file tree
Showing 8 changed files with 906 additions and 303 deletions.
2 changes: 1 addition & 1 deletion lib/src/common/logger/logger.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:flutter/foundation.dart';
import 'package:logger/logger.dart';

final Logger logger = Logger(
level: kReleaseMode ? Level.error : Level.debug,
level: kReleaseMode ? Level.error : Level.trace,
printer: PrettyPrinter(
colors: false,
noBoxingByDefault: true,
Expand Down
2 changes: 1 addition & 1 deletion lib/src/feature/database/bloc/database_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ class DatabaseBloc extends Bloc<DatabaseEvent, DatabaseState> {
hideFinish: (event) async {
await _db.hideFinish(event.id);
},
hideAllFinises: (event) async {
hideAllFinishes: (event) async {
await _db.hideAllFinishes(event.stageId);
},
clearNumberAtFinish: (event) async {
Expand Down
574 changes: 287 additions & 287 deletions lib/src/feature/database/bloc/database_bloc.freezed.dart

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/src/feature/database/bloc/database_event.dart
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ class DatabaseEvent with _$DatabaseEvent {
const factory DatabaseEvent.clearFinishResultsDebug(int stageId) =
_ClearFinishResultsDebug;

const factory DatabaseEvent.hideAllFinises(int stageId) = _HideAllFinises;
const factory DatabaseEvent.hideAllFinishes(int stageId) = _HideAllFinishes;

const factory DatabaseEvent.clearNumberAtFinish({
required Stage stage,
Expand Down
2 changes: 1 addition & 1 deletion lib/src/feature/database/widget/finish_list_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ class _FinishListPage extends State<FinishListPage> {
}
case FinishPopupMenu.hideAll:
final stageId = stage.id;
databaseBloc.add(DatabaseEvent.hideAllFinises(stageId));
databaseBloc.add(DatabaseEvent.hideAllFinishes(stageId));
case FinishPopupMenu.details:
final currentContext = context;
if (currentContext.mounted) {
Expand Down
10 changes: 3 additions & 7 deletions test/src/feature/countdown/bloc/countdown_bloc_test.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import 'dart:math';

import 'package:bloc_test/bloc_test.dart';
import 'package:entime/src/feature/audio/audio.dart';
import 'package:entime/src/feature/countdown/bloc/countdown_bloc.dart';
Expand Down Expand Up @@ -82,9 +80,8 @@ void main() {
blocTest<CountdownBloc, CountdownState>(
'ConnectivityProvider states emits in order',
setUp: () {
final rand = Random();
for (var i = 0; i < 5; i++) {
ticks.add(Tick(second: rand.nextInt(60), text: text));
ticks.add(Tick(second: i, text: text));
}
when(() => countdownAtStart.value).thenAnswer(
(_) =>
Expand All @@ -104,14 +101,13 @@ void main() {
blocTest<CountdownBloc, CountdownState>(
'ConnectivityProvider states emits in order and netStartTime not null',
setUp: () {
final rand = Random();
for (var i = 0; i < 5; i++) {
ticks.add(
Tick(
second: rand.nextInt(60),
second: i,
text: text,
nextStartTime: DateTime.now(),
number: rand.nextInt(100),
number: i,
),
);
}
Expand Down
Loading

0 comments on commit 27fa75d

Please sign in to comment.