Fix a few lints
This commit is contained in:
@@ -4,6 +4,6 @@ import 'package:test/test.dart';
|
||||
|
||||
void main() {
|
||||
test('Assert 2136 kanji in jouyou set', () {
|
||||
expect(JOUYOU_KANJI_BY_GRADES.values.flattenedToSet.length, 2136);
|
||||
expect(jouyouKanjiByGrades.values.flattenedToSet.length, 2136);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,21 +1,20 @@
|
||||
import 'dart:ffi';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:jadb/models/create_empty_db.dart';
|
||||
import 'package:jadb/search.dart';
|
||||
import 'package:sqflite_common_ffi/sqflite_ffi.dart';
|
||||
// import 'package:sqlite3/open.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
Future<DatabaseExecutor> setup_inmemory_database() async {
|
||||
final dbConnection = await createDatabaseFactoryFfi().openDatabase(':memory:');
|
||||
Future<DatabaseExecutor> setupInMemoryDatabase() async {
|
||||
final dbConnection = await createDatabaseFactoryFfi().openDatabase(
|
||||
':memory:',
|
||||
);
|
||||
|
||||
return dbConnection;
|
||||
}
|
||||
|
||||
void main() {
|
||||
test('Create empty db', () async {
|
||||
final db = await setup_inmemory_database();
|
||||
final db = await setupInMemoryDatabase();
|
||||
|
||||
await createEmptyDb(db);
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import 'setup_database_connection.dart';
|
||||
|
||||
void main() {
|
||||
test('Filter kanji', () async {
|
||||
final connection = await setup_database_connection();
|
||||
final connection = await setupDatabaseConnection();
|
||||
|
||||
final result = await connection.filterKanji([
|
||||
'a',
|
||||
|
||||
@@ -6,16 +6,16 @@ import 'setup_database_connection.dart';
|
||||
|
||||
void main() {
|
||||
test('Search a kanji', () async {
|
||||
final connection = await setup_database_connection();
|
||||
final connection = await setupDatabaseConnection();
|
||||
|
||||
final result = await connection.jadbSearchKanji('漢');
|
||||
expect(result, isNotNull);
|
||||
});
|
||||
|
||||
group('Search all jouyou kanji', () {
|
||||
JOUYOU_KANJI_BY_GRADES.forEach((grade, characters) {
|
||||
jouyouKanjiByGrades.forEach((grade, characters) {
|
||||
test('Search all kanji in grade $grade', () async {
|
||||
final connection = await setup_database_connection();
|
||||
final connection = await setupDatabaseConnection();
|
||||
|
||||
for (final character in characters) {
|
||||
final result = await connection.jadbSearchKanji(character);
|
||||
|
||||
@@ -3,7 +3,7 @@ import 'dart:io';
|
||||
import 'package:jadb/_data_ingestion/open_local_db.dart';
|
||||
import 'package:sqflite_common/sqlite_api.dart';
|
||||
|
||||
Future<Database> setup_database_connection() async {
|
||||
Future<Database> setupDatabaseConnection() async {
|
||||
final libSqlitePath = Platform.environment['LIBSQLITE_PATH'];
|
||||
final jadbPath = Platform.environment['JADB_PATH'];
|
||||
|
||||
|
||||
@@ -5,43 +5,43 @@ import 'setup_database_connection.dart';
|
||||
|
||||
void main() {
|
||||
test('Search a word - english - auto', () async {
|
||||
final connection = await setup_database_connection();
|
||||
final connection = await setupDatabaseConnection();
|
||||
final result = await connection.jadbSearchWord('kana');
|
||||
expect(result, isNotNull);
|
||||
});
|
||||
|
||||
test('Get word search count - english - auto', () async {
|
||||
final connection = await setup_database_connection();
|
||||
final connection = await setupDatabaseConnection();
|
||||
final result = await connection.jadbSearchWordCount('kana');
|
||||
expect(result, isNotNull);
|
||||
});
|
||||
|
||||
test('Search a word - japanese kana - auto', () async {
|
||||
final connection = await setup_database_connection();
|
||||
final connection = await setupDatabaseConnection();
|
||||
final result = await connection.jadbSearchWord('かな');
|
||||
expect(result, isNotNull);
|
||||
});
|
||||
|
||||
test('Get word search count - japanese kana - auto', () async {
|
||||
final connection = await setup_database_connection();
|
||||
final connection = await setupDatabaseConnection();
|
||||
final result = await connection.jadbSearchWordCount('かな');
|
||||
expect(result, isNotNull);
|
||||
});
|
||||
|
||||
test('Search a word - japanese kanji - auto', () async {
|
||||
final connection = await setup_database_connection();
|
||||
final connection = await setupDatabaseConnection();
|
||||
final result = await connection.jadbSearchWord('仮名');
|
||||
expect(result, isNotNull);
|
||||
});
|
||||
|
||||
test('Get word search count - japanese kanji - auto', () async {
|
||||
final connection = await setup_database_connection();
|
||||
final connection = await setupDatabaseConnection();
|
||||
final result = await connection.jadbSearchWordCount('仮名');
|
||||
expect(result, isNotNull);
|
||||
});
|
||||
|
||||
test('Get a word by id', () async {
|
||||
final connection = await setup_database_connection();
|
||||
final connection = await setupDatabaseConnection();
|
||||
final result = await connection.jadbGetWordById(1577090);
|
||||
expect(result, isNotNull);
|
||||
});
|
||||
@@ -49,7 +49,7 @@ void main() {
|
||||
test(
|
||||
'Serialize all words',
|
||||
() async {
|
||||
final connection = await setup_database_connection();
|
||||
final connection = await setupDatabaseConnection();
|
||||
|
||||
// Test serializing all words
|
||||
for (final letter in 'aiueoksthnmyrw'.split('')) {
|
||||
|
||||
Reference in New Issue
Block a user