@@ -9,7 +9,10 @@ class MockFlutterCryptoAlgorithmPlatform
99 implements FlutterCryptoAlgorithmPlatform {
1010
1111 @override
12- Future <String ?> getPlatformVersion () => Future .value ('42' );
12+ Future <String ?> encrypt (String value, String privateKey, String ? ivKey) => Future .value ('IVVM1yR+Cn2Bbxo7RnkAQw==' );
13+
14+ @override
15+ Future <String ?> decrypt (String value, String privateKey, String ? ivKey) => Future .value ('Hello123' );
1316}
1417
1518void main () {
@@ -19,11 +22,19 @@ void main() {
1922 expect (initialPlatform, isInstanceOf <MethodChannelFlutterCryptoAlgorithm >());
2023 });
2124
22- test ('getPlatformVersion' , () async {
25+ test ('encrypt' , () async {
26+ FlutterCryptoAlgorithm flutterCryptoAlgorithmPlugin = FlutterCryptoAlgorithm ();
27+ MockFlutterCryptoAlgorithmPlatform fakePlatform = MockFlutterCryptoAlgorithmPlatform ();
28+ FlutterCryptoAlgorithmPlatform .instance = fakePlatform;
29+
30+ expect (await flutterCryptoAlgorithmPlugin.encrypt ('Hello123' , 'Hello' ), 'IVVM1yR+Cn2Bbxo7RnkAQw==' );
31+ });
32+
33+ test ('decrypt' , () async {
2334 FlutterCryptoAlgorithm flutterCryptoAlgorithmPlugin = FlutterCryptoAlgorithm ();
2435 MockFlutterCryptoAlgorithmPlatform fakePlatform = MockFlutterCryptoAlgorithmPlatform ();
2536 FlutterCryptoAlgorithmPlatform .instance = fakePlatform;
2637
27- expect (await flutterCryptoAlgorithmPlugin.getPlatformVersion ( ), '42 ' );
38+ expect (await flutterCryptoAlgorithmPlugin.decrypt ( 'IVVM1yR+Cn2Bbxo7RnkAQw==' , 'Hello' ), 'Hello123 ' );
2839 });
2940}
0 commit comments