dashPi: a self-hosted home dashboard, its sync server and phone app
The dashboard (Raspberry Pi 3.5" screen + web pages), the end-to-end encrypted sync mailbox (PHP + SQLite) and the Android companion app (Flutter), with docs, clean-install checks and screenshots made from demo data. Built mostly with an AI coding assistant; not yet reviewed line by line by a human (see README and SECURITY.md). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
fb3c01cdd7
333 changed files with 45151 additions and 0 deletions
35
app/test/location_test.dart
Normal file
35
app/test/location_test.dart
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
// app/location.dart against a stand-in for MainActivity's "dash/location": a fix, or why there's none.
|
||||
import 'package:dash_app/app/location.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
TestWidgetsFlutterBinding.ensureInitialized();
|
||||
const ch = MethodChannel('dash/location');
|
||||
|
||||
Future<(({double lat, double lon})?, String)> run(Map<String, Object?> answers) async {
|
||||
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
|
||||
.setMockMethodCallHandler(ch, (c) async => answers[c.method]);
|
||||
var why = '';
|
||||
final at = await whereAmI(none: (w) => why = w);
|
||||
return (at, why);
|
||||
}
|
||||
|
||||
test('not allowed, refused again', () async {
|
||||
expect(await run({'status': {'allowed': false, 'enabled': true}, 'ask': false}), (null, 'location not allowed'));
|
||||
});
|
||||
test('switched off', () async {
|
||||
expect(await run({'status': {'allowed': true, 'enabled': false}}), (null, 'location off'));
|
||||
});
|
||||
test('the last fix', () async {
|
||||
final (at, _) = await run({'status': {'allowed': true, 'enabled': true}, 'last': {'lat': 47.17, 'lon': 24.06}});
|
||||
expect((at!.lat, at.lon), (47.17, 24.06));
|
||||
});
|
||||
test('allowed now, a new fix', () async {
|
||||
final (at, _) = await run({'status': {'allowed': false, 'enabled': true}, 'ask': true, 'last': null, 'current': {'lat': 46.77, 'lon': 23.6}});
|
||||
expect(at!.lat, 46.77);
|
||||
});
|
||||
test('nothing found', () async {
|
||||
expect(await run({'status': {'allowed': true, 'enabled': true}, 'last': null, 'current': null}), (null, 'no location found'));
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue