Merge branch 'spike/block2-derisking'
This commit is contained in:
commit
8a55034118
12 changed files with 131 additions and 66 deletions
|
|
@ -15,12 +15,18 @@ void main() {
|
|||
late SocialSettings settings;
|
||||
setUp(() => settings = SocialSettings(FakeSecretStore()));
|
||||
|
||||
test('defaults: empty area, no relays, not configured', () async {
|
||||
test('defaults: empty area, but relays fall back to the defaults', () async {
|
||||
expect(await settings.areaGeohash(), '');
|
||||
expect(await settings.relayUrls(), isEmpty);
|
||||
expect(await settings.relayUrls(), SocialSettings.defaultRelays);
|
||||
// Not configured yet: the area is still unset.
|
||||
expect(await settings.isConfigured, isFalse);
|
||||
});
|
||||
|
||||
test('an explicitly empty relay choice turns the network off', () async {
|
||||
await settings.setRelayUrls(const []);
|
||||
expect(await settings.relayUrls(), isEmpty);
|
||||
});
|
||||
|
||||
test('stores and normalises the area geohash (trim + lowercase)', () async {
|
||||
await settings.setAreaGeohash(' SP3E9 ');
|
||||
expect(await settings.areaGeohash(), 'sp3e9');
|
||||
|
|
@ -36,10 +42,9 @@ void main() {
|
|||
['wss://relay.comunes.org', 'wss://seeds.example.org']);
|
||||
});
|
||||
|
||||
test('is configured only with both an area and at least one relay', () async {
|
||||
test('is configured once an area is set (relays are defaulted)', () async {
|
||||
expect(await settings.isConfigured, isFalse); // no area yet
|
||||
await settings.setAreaGeohash('sp3e9');
|
||||
expect(await settings.isConfigured, isFalse);
|
||||
await settings.setRelayUrls(['wss://relay.comunes.org']);
|
||||
expect(await settings.isConfigured, isTrue);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ void main() {
|
|||
(tester) async {
|
||||
final social = await SocialService.fromRootSeedHex('00' * 32);
|
||||
final settings = SocialSettings(InMemorySecretStore());
|
||||
await settings.setRelayUrls(const []); // offline: don't hit the network
|
||||
LocaleSettings.setLocaleSync(AppLocale.en);
|
||||
|
||||
await tester.pumpWidget(
|
||||
|
|
|
|||
|
|
@ -110,6 +110,7 @@ void main() {
|
|||
(tester) async {
|
||||
final social = await SocialService.fromRootSeedHex('00' * 32);
|
||||
final settings = SocialSettings(InMemorySecretStore());
|
||||
await settings.setRelayUrls(const []); // offline: don't hit the network
|
||||
LocaleSettings.setLocaleSync(AppLocale.en);
|
||||
|
||||
await tester.pumpWidget(
|
||||
|
|
@ -136,6 +137,7 @@ void main() {
|
|||
(tester) async {
|
||||
final social = await SocialService.fromRootSeedHex('00' * 32);
|
||||
final settings = SocialSettings(InMemorySecretStore());
|
||||
await settings.setRelayUrls(const []); // offline: don't hit the network
|
||||
LocaleSettings.setLocaleSync(AppLocale.en);
|
||||
|
||||
await tester.pumpWidget(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue