chore(config): 更新开发默认服务器地址
This commit is contained in:
1 parent
53b77263ca
commit
cb2fa920ea
2 files changed
+6
-6
No files matched your search
@@ -13,7 +13,7 @@ class AppConfig {
|
|||||||
///
|
///
|
||||||
/// 这个地址跟着电脑所在的网络走,换网络后要用
|
/// 这个地址跟着电脑所在的网络走,换网络后要用
|
||||||
/// `ipconfig getifaddr en0` 重新确认。默认值只改这一行。
|
/// `ipconfig getifaddr en0` 重新确认。默认值只改这一行。
|
||||||
static const String devHostBaseUrl = 'http://192.168.31.250:8081';
|
static const String devHostBaseUrl = 'http://172.18.0.7:8081';
|
||||||
|
|
||||||
static const String _loopbackBaseUrl = 'http://127.0.0.1:8081';
|
static const String _loopbackBaseUrl = 'http://127.0.0.1:8081';
|
||||||
|
|
||||||
|
|||||||
@@ -57,13 +57,13 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('should_use_the_configured_lan_address_for_device_default', () {
|
test('should_use_the_configured_lan_address_for_device_default', () {
|
||||||
expect(AppConfig.devHostBaseUrl, 'http://192.168.31.250:8081');
|
expect(AppConfig.devHostBaseUrl, 'http://172.18.0.7:8081');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should_apply_stored_url_only_when_debug_is_enabled', () async {
|
test('should_apply_stored_url_only_when_debug_is_enabled', () async {
|
||||||
SharedPreferencesAsyncPlatform.instance =
|
SharedPreferencesAsyncPlatform.instance =
|
||||||
InMemorySharedPreferencesAsync.withData({
|
InMemorySharedPreferencesAsync.withData({
|
||||||
ServerEndpoint.preferenceKey: ' http://192.168.31.250:8081/ ',
|
ServerEndpoint.preferenceKey: ' http://172.18.0.7:8081/ ',
|
||||||
});
|
});
|
||||||
final original = AppConfig.apiBaseUrl;
|
final original = AppConfig.apiBaseUrl;
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ void main() {
|
|||||||
expect(AppConfig.apiBaseUrl, original);
|
expect(AppConfig.apiBaseUrl, original);
|
||||||
|
|
||||||
await ServerEndpoint.load(debug: true);
|
await ServerEndpoint.load(debug: true);
|
||||||
expect(AppConfig.apiBaseUrl, 'http://192.168.31.250:8081');
|
expect(AppConfig.apiBaseUrl, 'http://172.18.0.7:8081');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should_save_normalized_url_and_clear_override', () async {
|
test('should_save_normalized_url_and_clear_override', () async {
|
||||||
@@ -81,10 +81,10 @@ void main() {
|
|||||||
isNull,
|
isNull,
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(await ServerEndpoint.save(' http://192.168.31.250:8081/ '), isTrue);
|
expect(await ServerEndpoint.save(' http://172.18.0.7:8081/ '), isTrue);
|
||||||
expect(
|
expect(
|
||||||
await SharedPreferencesAsync().getString(ServerEndpoint.preferenceKey),
|
await SharedPreferencesAsync().getString(ServerEndpoint.preferenceKey),
|
||||||
'http://192.168.31.250:8081',
|
'http://172.18.0.7:8081',
|
||||||
);
|
);
|
||||||
|
|
||||||
await ServerEndpoint.clear();
|
await ServerEndpoint.clear();
|
||||||
|
|||||||
Reference in new issue
Block a user