Skip to content

Commit

Permalink
UssdRemoteDatasource test
Browse files Browse the repository at this point in the history
  • Loading branch information
Luis Ciber committed Aug 21, 2021
1 parent f35b984 commit 947aefc
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/app/app_environment.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ class AppEnvironmentProd extends AppEnvironment {
AppEnvironmentProd()
: super(
ussdCodesHashRemote:
'https://todo-devs.github.io/todo-json/config.json',
ussdCodesRemote: 'https://todo-devs.github.io/todo-json/hash.json',
'https://todo-devs.github.io/todo-json/hash.json',
ussdCodesRemote: 'https://todo-devs.github.io/todo-json/config.json',
);
}

Expand All @@ -27,7 +27,7 @@ class AppEnvironmentDev extends AppEnvironment {
AppEnvironmentDev()
: super(
ussdCodesHashRemote:
'https://todo-devs.github.io/todo-json/config.json',
ussdCodesRemote: 'https://todo-devs.github.io/todo-json/hash.json',
'https://todo-devs.github.io/todo-json/hash.json',
ussdCodesRemote: 'https://todo-devs.github.io/todo-json/config.json',
);
}
34 changes: 34 additions & 0 deletions test/datasources/ussd_remote_datasource_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:todo/app/app.dart';

void main() {
late UssdRemoteDatasource datasource;
late HttpClient http;
late AppEnvironment environment;

setUp(() {
environment = AppEnvironmentProd();
http = HttpClient();
datasource = UssdRemoteDatasource(
environment,
http,
);
});

test('Get HASH', () async {
final result = await datasource.getHash();

debugPrint(result.toString());

expect(result.isNotEmpty, true);
});

test('Get Codes', () async {
final result = await datasource.getUssdCodes();

debugPrint(result.toString());

expect(result.isNotEmpty, true);
});
}

0 comments on commit 947aefc

Please sign in to comment.