Skip to content

Commit

Permalink
test chapa getInstance
Browse files Browse the repository at this point in the history
  • Loading branch information
mrnpro committed Feb 24, 2024
1 parent 1c23e37 commit 2547301
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 31 deletions.
6 changes: 1 addition & 5 deletions .flutter-plugins
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
# This is a generated file; do not edit or check into version control.
<<<<<<< HEAD
flutter_inappwebview=C:\\Users\\MRN\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\flutter_inappwebview-5.7.2+3\\
=======
flutter_inappwebview=/Users/ngtech/.pub-cache/hosted/pub.dev/flutter_inappwebview-5.7.2+3/
>>>>>>> 77f08e7d53ac539a814004c22213040693b5b14c
flutter_inappwebview=C:\\Users\\MRN\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\flutter_inappwebview-5.8.0\\
6 changes: 1 addition & 5 deletions .flutter-plugins-dependencies
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
<<<<<<< HEAD
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_inappwebview","path":"C:\\\\Users\\\\MRN\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\flutter_inappwebview-5.7.2+3\\\\","native_build":true,"dependencies":[]}],"android":[{"name":"flutter_inappwebview","path":"C:\\\\Users\\\\MRN\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\flutter_inappwebview-5.7.2+3\\\\","native_build":true,"dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"flutter_inappwebview","dependencies":[]}],"date_created":"2023-09-27 12:26:17.396528","version":"3.10.6"}
=======
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_inappwebview","path":"/Users/ngtech/.pub-cache/hosted/pub.dev/flutter_inappwebview-5.7.2+3/","native_build":true,"dependencies":[]}],"android":[{"name":"flutter_inappwebview","path":"/Users/ngtech/.pub-cache/hosted/pub.dev/flutter_inappwebview-5.7.2+3/","native_build":true,"dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"flutter_inappwebview","dependencies":[]}],"date_created":"2023-09-27 21:27:44.239732","version":"3.7.11"}
>>>>>>> 77f08e7d53ac539a814004c22213040693b5b14c
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_inappwebview","path":"C:\\\\Users\\\\MRN\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\flutter_inappwebview-5.8.0\\\\","native_build":true,"dependencies":[]}],"android":[{"name":"flutter_inappwebview","path":"C:\\\\Users\\\\MRN\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\flutter_inappwebview-5.8.0\\\\","native_build":true,"dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"flutter_inappwebview","dependencies":[]}],"date_created":"2024-02-24 12:19:16.453987","version":"3.16.8"}
58 changes: 37 additions & 21 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ packages:
description:
path: "."
ref: HEAD
resolved-ref: d6fffb44055a740a30f14bd89786f0f743f250f4
resolved-ref: "05c6b3ee458bcc0c75323281457ff075a384eb2c"
url: "https://github.com/mrnpro/ChapaFlutter.git"
source: git
version: "0.0.1"
version: "0.0.3"
characters:
dependency: transitive
description:
Expand All @@ -46,10 +46,10 @@ packages:
dependency: transitive
description:
name: collection
sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
url: "https://pub.dev"
source: hosted
version: "1.17.2"
version: "1.18.0"
crypto:
dependency: transitive
description:
Expand All @@ -70,10 +70,10 @@ packages:
dependency: transitive
description:
name: dio
sha256: "417e2a6f9d83ab396ec38ff4ea5da6c254da71e4db765ad737a42af6930140b7"
sha256: "49af28382aefc53562459104f64d16b9dfd1e8ef68c862d5af436cc8356ce5a8"
url: "https://pub.dev"
source: hosted
version: "5.3.3"
version: "5.4.1"
equatable:
dependency: transitive
description:
Expand All @@ -90,6 +90,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.3.1"
fixnum:
dependency: transitive
description:
name: fixnum
sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1"
url: "https://pub.dev"
source: hosted
version: "1.1.0"
flutter:
dependency: "direct main"
description: flutter
Expand All @@ -99,10 +107,10 @@ packages:
dependency: transitive
description:
name: flutter_inappwebview
sha256: f73505c792cf083d5566e1a94002311be497d984b5607f25be36d685cf6361cf
sha256: d198297060d116b94048301ee6749cd2e7d03c1f2689783f52d210a6b7aba350
url: "https://pub.dev"
source: hosted
version: "5.7.2+3"
version: "5.8.0"
flutter_lints:
dependency: "direct dev"
description:
Expand Down Expand Up @@ -152,10 +160,10 @@ packages:
dependency: transitive
description:
name: meta
sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3"
sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e
url: "https://pub.dev"
source: hosted
version: "1.9.1"
version: "1.10.0"
path:
dependency: transitive
description:
Expand All @@ -177,22 +185,30 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.10.0"
sprintf:
dependency: transitive
description:
name: sprintf
sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23"
url: "https://pub.dev"
source: hosted
version: "7.0.0"
stack_trace:
dependency: transitive
description:
name: stack_trace
sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5
sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
url: "https://pub.dev"
source: hosted
version: "1.11.0"
version: "1.11.1"
stream_channel:
dependency: transitive
description:
name: stream_channel
sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8"
sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
url: "https://pub.dev"
source: hosted
version: "2.1.1"
version: "2.1.2"
string_scanner:
dependency: transitive
description:
Expand All @@ -213,10 +229,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8"
sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b"
url: "https://pub.dev"
source: hosted
version: "0.6.0"
version: "0.6.1"
typed_data:
dependency: transitive
description:
Expand All @@ -229,10 +245,10 @@ packages:
dependency: transitive
description:
name: uuid
sha256: "648e103079f7c64a36dc7d39369cabb358d377078a051d6ae2ad3aa539519313"
sha256: cd210a09f7c18cbe5a02511718e0334de6559871052c90a90c0cca46a4aa81c8
url: "https://pub.dev"
source: hosted
version: "3.0.7"
version: "4.3.3"
vector_math:
dependency: transitive
description:
Expand All @@ -245,10 +261,10 @@ packages:
dependency: transitive
description:
name: web
sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10
sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152
url: "https://pub.dev"
source: hosted
version: "0.1.4-beta"
version: "0.3.0"
sdks:
dart: ">=3.1.0-185.0.dev <4.0.0"
dart: ">=3.2.0-194.0.dev <4.0.0"
flutter: ">=3.0.0"
5 changes: 5 additions & 0 deletions lib/src/chapa.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ class Chapa {
_instance ??= _setup(privateKey);
return _instance!;
}
// Reset Chapa configuration
static void resetConfiguration() {
_privateKey = null;
_instance = null;
}

/// Starts the payment process.
///
Expand Down
8 changes: 8 additions & 0 deletions test/chapa_unofficial_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,13 @@ void main() {
expect(() => chapa.verifyPayment(txRef: 'tx123'),
throwsA(isA<AuthException>()));
});
test(
'chapa getInstance should throw AuthException if privateKey is not configured',
() {
// reset everything to test this test works
Chapa.resetConfiguration();

expect(() => Chapa.getInstance, throwsA(isA<AuthException>()));
});
});
}

0 comments on commit 2547301

Please sign in to comment.