This commit is contained in:
1 parent
925a9be18e
commit
ca85b66e87
5 files changed
+85
-52
No files matched your search
@@ -68,21 +68,22 @@ void main() {
|
||||
: ProdConfig.baseUrl;
|
||||
expect(AppConfig.baseUrl, expected);
|
||||
expect(AppConfig.apiBaseUrl, expected);
|
||||
expect(Uri.parse(AppConfig.baseUrl).port, 8081);
|
||||
final port = Uri.parse(AppConfig.baseUrl).port;
|
||||
expect(port, Uri.parse(AppConfig.baseUrl).scheme == 'https' ? 443 : 8081);
|
||||
});
|
||||
|
||||
test('should_keep_dev_and_prod_addresses_in_separate_files', () {
|
||||
final dev = Uri.parse(DevConfig.baseUrl);
|
||||
final prod = Uri.parse(ProdConfig.baseUrl);
|
||||
|
||||
expect(dev.scheme, 'http');
|
||||
expect(dev.host, isNot(prod.host));
|
||||
expect(dev.port, 8081);
|
||||
expect(dev.scheme, 'https');
|
||||
expect(dev.host, 'drama-api.frostgiant.vip');
|
||||
expect(dev.port, 443);
|
||||
expect(dev.path, isEmpty);
|
||||
expect(prod.scheme, 'http');
|
||||
expect(prod.port, 8081);
|
||||
expect(prod.scheme, 'https');
|
||||
expect(prod.port, prod.scheme == 'https' ? 443 : 8081);
|
||||
expect(prod.path, isEmpty);
|
||||
expect(DevConfig.baseUrl, isNot(ProdConfig.baseUrl));
|
||||
expect(DevConfig.baseUrl, ProdConfig.baseUrl);
|
||||
});
|
||||
|
||||
test('should_prefer_runtime_override_over_environment_switch', () {
|
||||
@@ -121,6 +122,21 @@ void main() {
|
||||
expect(AppConfig.apiBaseUrl, 'http://192.168.31.187:8081');
|
||||
});
|
||||
|
||||
test('should_remove_legacy_local_url_when_loading_uat_debug', () async {
|
||||
SharedPreferencesAsyncPlatform.instance =
|
||||
InMemorySharedPreferencesAsync.withData({
|
||||
ServerEndpoint.preferenceKey: ServerEndpoint.legacyLocalBaseUrl,
|
||||
});
|
||||
|
||||
await ServerEndpoint.load(debug: true);
|
||||
|
||||
expect(AppConfig.apiBaseUrl, AppConfig.baseUrl);
|
||||
expect(
|
||||
await SharedPreferencesAsync().getString(ServerEndpoint.preferenceKey),
|
||||
isNull,
|
||||
);
|
||||
});
|
||||
|
||||
test('should_save_normalized_url_and_clear_override', () async {
|
||||
expect(await ServerEndpoint.save('ftp://invalid'), isFalse);
|
||||
expect(
|
||||
|
||||
Reference in new issue
Block a user