55 lines
1.3 KiB
Dart
55 lines
1.3 KiB
Dart
@Tags(['integration', 'postgres'])
|
||
library;
|
||
|
||
import 'package:postgres/postgres.dart';
|
||
import 'package:test/test.dart';
|
||
|
||
import '../helpers/test_db.dart';
|
||
|
||
void main() {
|
||
TestDb? testDb;
|
||
|
||
setUpAll(() async {
|
||
testDb = await TestDb.open();
|
||
});
|
||
|
||
tearDownAll(() async {
|
||
await testDb?.close();
|
||
});
|
||
|
||
test('migrations 001–004 apply on cyberhybridhub_test', () async {
|
||
if (testDb == null) {
|
||
markTestSkipped('Set DATABASE_URL or TEST_DATABASE_URL for integration tests');
|
||
return;
|
||
}
|
||
|
||
final Connection connection = testDb!.connection;
|
||
final Result tables = await connection.execute(
|
||
'''
|
||
SELECT table_name
|
||
FROM information_schema.tables
|
||
WHERE table_schema = 'public'
|
||
AND table_name IN (
|
||
'users',
|
||
'questions',
|
||
'market_data_snapshots',
|
||
'trading_config_templates',
|
||
'user_trading_config',
|
||
'user_trading_state',
|
||
'trade_orders'
|
||
)
|
||
ORDER BY table_name
|
||
''',
|
||
);
|
||
expect(tables.map((ResultRow r) => r[0]), hasLength(7));
|
||
|
||
final Result template = await connection.execute(
|
||
Sql.named(
|
||
'SELECT name FROM trading_config_templates WHERE name = @name',
|
||
),
|
||
parameters: <String, dynamic>{'name': 'default_paper_watchlist'},
|
||
);
|
||
expect(template, isNotEmpty);
|
||
});
|
||
}
|