From 9efbc158648aed1d587cf33c89c1268826d2586a Mon Sep 17 00:00:00 2001 From: derdilla <82763757+NobodyForNothing@users.noreply.github.com> Date: Sat, 27 Jul 2024 20:30:11 +0900 Subject: [PATCH] fix flutter tests --- apps/calculator/test/widget_test.dart | 6 +++++- apps/rewordle/lib/persistence.dart | 4 ++-- apps/rewordle/test/persistence_test.dart | 4 ++-- packages/app_base/test/app_base_test.dart | 6 +++++- packages/file_entry/test/file_entry_test.dart | 4 +++- 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/apps/calculator/test/widget_test.dart b/apps/calculator/test/widget_test.dart index ab73b3a..552c4f5 100644 --- a/apps/calculator/test/widget_test.dart +++ b/apps/calculator/test/widget_test.dart @@ -1 +1,5 @@ -void main() {} +import 'package:flutter_test/flutter_test.dart'; + +void main() { + test('TODO: test calculator app',(){}); +} diff --git a/apps/rewordle/lib/persistence.dart b/apps/rewordle/lib/persistence.dart index 616a3b6..8ef3833 100644 --- a/apps/rewordle/lib/persistence.dart +++ b/apps/rewordle/lib/persistence.dart @@ -72,10 +72,10 @@ class GameState { return '$correctWord|$wrongLetters|$wrongPosLetters|$okLetters|$submissionsString'; } - String? addWord(String word) { + String? addWord(String word, [bool skipWordListValidation = false]) { final letters = word.split(''); if (letters.length != 5) return 'Not 5 letters long'; - if (!VALID_WORDS.contains(word)) return 'Not in word list'; + if (!(skipWordListValidation || VALID_WORDS.contains(word))) return 'Not in word list'; final correct = correctWord.split(''); final checked = []; diff --git a/apps/rewordle/test/persistence_test.dart b/apps/rewordle/test/persistence_test.dart index d8b105b..e1b6c4b 100644 --- a/apps/rewordle/test/persistence_test.dart +++ b/apps/rewordle/test/persistence_test.dart @@ -21,7 +21,7 @@ void main() { }); test('determines letters at correct positions and not in word', () { final s = GameState('AAAAA'); - expect(s.addWord('ABBAA'), isNull); + expect(s.addWord('ABBAA', true), isNull); expect(s.submitted[0][0].state, LetterCorrectness.ok); expect(s.submitted[0][1].state, LetterCorrectness.err); @@ -31,7 +31,7 @@ void main() { }); test('determines letters at wrong positions', () { final s = GameState('ABCDE'); - expect(s.addWord('XCXEE'), isNull); + expect(s.addWord('XCXEE', true), isNull); expect(s.submitted[0][0].state, LetterCorrectness.err); expect(s.submitted[0][1].state, LetterCorrectness.warn); diff --git a/packages/app_base/test/app_base_test.dart b/packages/app_base/test/app_base_test.dart index ab73b3a..d0e22b3 100644 --- a/packages/app_base/test/app_base_test.dart +++ b/packages/app_base/test/app_base_test.dart @@ -1 +1,5 @@ -void main() {} +import 'package:flutter_test/flutter_test.dart'; + +void main() { + test('TODO: test app_base package',(){}); +} diff --git a/packages/file_entry/test/file_entry_test.dart b/packages/file_entry/test/file_entry_test.dart index 21f3e9f..54d8c2f 100644 --- a/packages/file_entry/test/file_entry_test.dart +++ b/packages/file_entry/test/file_entry_test.dart @@ -1,3 +1,5 @@ +import 'package:flutter_test/flutter_test.dart'; + void main() { - // TODO + test('TODO: test file_entry package',(){}); }