feat(flutter): 增加 debug 服务地址编辑器
This commit is contained in:
1 parent
eab5d3e230
commit
c259b0b543
9 files changed
+298
-5
No files matched your search
@@ -113,6 +113,22 @@ void main() {
|
||||
expect(AppConfig.apiBaseUrl, AppConfig.devHostBaseUrl);
|
||||
});
|
||||
|
||||
test('should_probe_explicit_runtime_endpoint_first', () async {
|
||||
const custom = 'http://custom.test:8081';
|
||||
final attempts = <String>[];
|
||||
AppConfig.applyRuntimeBaseUrl(custom);
|
||||
|
||||
await AppConfig.probeAndApplyBaseUrl(
|
||||
probe: (baseUrl) async {
|
||||
attempts.add(baseUrl);
|
||||
return baseUrl == custom;
|
||||
},
|
||||
);
|
||||
|
||||
expect(attempts, [custom]);
|
||||
expect(AppConfig.apiBaseUrl, custom);
|
||||
});
|
||||
|
||||
test('should_apply_stored_url_only_when_debug_is_enabled', () async {
|
||||
SharedPreferencesAsyncPlatform.instance =
|
||||
InMemorySharedPreferencesAsync.withData({
|
||||
@@ -139,6 +155,7 @@ void main() {
|
||||
await SharedPreferencesAsync().getString(ServerEndpoint.preferenceKey),
|
||||
'http://192.168.31.187:8081',
|
||||
);
|
||||
expect(AppConfig.apiBaseUrl, 'http://192.168.31.187:8081');
|
||||
|
||||
await ServerEndpoint.clear();
|
||||
expect(
|
||||
|
||||
Reference in new issue
Block a user