mnemo_cards/mnemo_cards_backend/test/database/database_test.dart

41 lines
1.2 KiB
Dart
Raw Normal View History

2025-12-17 00:41:47 +00:00
import 'package:test/test.dart';
import 'package:mnemo_cards_backend/database/database.dart';
void main() {
group('Database Schema Tests', () {
test('AppDatabase can be instantiated', () {
// This test verifies that the database class can be created
// Actual connection will be tested with real PostgreSQL instance
expect(() => AppDatabase.connect(
host: 'localhost',
port: 5432,
database: 'test_db',
username: 'test_user',
password: 'test_pass',
), returnsNormally);
});
test('All tables are registered', () {
// Verify that all expected tables are in the database
final db = AppDatabase.connect(
host: 'localhost',
port: 5432,
database: 'test_db',
username: 'test_user',
password: 'test_pass',
);
// Check that DAOs are available
expect(db.userDao, isNotNull);
expect(db.packDao, isNotNull);
expect(db.testDao, isNotNull);
expect(db.paymentDao, isNotNull);
expect(db.subscriptionDao, isNotNull);
expect(db.taskDao, isNotNull);
expect(db.promoCodeDao, isNotNull);
expect(db.discountDao, isNotNull);
expect(db.statisticsDao, isNotNull);
});
});
}