Skip to content
This repository has been archived by the owner on Feb 9, 2024. It is now read-only.

Commit

Permalink
Add test for checking WalletProxyConfig url
Browse files Browse the repository at this point in the history
  • Loading branch information
Hjort committed Nov 16, 2023
1 parent 76b553b commit 98a8a07
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/services/wallet_proxy/service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:concordium_wallet/services/wallet_proxy/model.dart';

/// Paths of the wallet-proxy endpoints.
enum WalletProxyEndpoint {
termsAndConditionsVersion('/v0/termsAndConditionsVersion');
termsAndConditionsVersion('v0/termsAndConditionsVersion');

final String path;

Expand Down
9 changes: 6 additions & 3 deletions test/wallet_proxy_service_test.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:concordium_wallet/services/http.dart';
import 'package:concordium_wallet/services/wallet_proxy/service.dart';
import 'package:concordium_wallet/state.dart';
import 'package:mocktail/mocktail.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:http/http.dart' as http;
Expand All @@ -24,9 +25,7 @@ void main() {

var httpClient = MockHttpService(rawData);

var service = WalletProxyService(
config: WalletProxyConfig(baseUrl: 'http://test.com'),
httpService: httpClient);
var service = WalletProxyService(config: WalletProxyConfig(baseUrl: 'http://test.com'), httpService: httpClient);

// Act
var tac = await service.getTac();
Expand All @@ -35,4 +34,8 @@ void main() {
expect(tac.url.toString(), tacUrl);
expect(tac.version, tacVersion);
});

test('WalletProxyConfig for testnet merges base and path correctly for terms and conditions', () {
expect(testnet.walletProxyConfig.urlOf(WalletProxyEndpoint.tacVersion).toString(), 'https://wallet-proxy.testnet.concordium.com/v0/termsAndConditionsVersion');
});
}

0 comments on commit 98a8a07

Please sign in to comment.