From 4f7b9fe45ed39d3de091f8305e924d671a8e738e Mon Sep 17 00:00:00 2001 From: purnimavenkatasubbu Date: Thu, 29 Sep 2022 16:04:09 +0530 Subject: [PATCH 1/3] added new tests --- at_commons/test/at_exception_stack_test.dart | 70 ++++++++++++++++++-- 1 file changed, 65 insertions(+), 5 deletions(-) diff --git a/at_commons/test/at_exception_stack_test.dart b/at_commons/test/at_exception_stack_test.dart index ccb35072..a92c7ed5 100644 --- a/at_commons/test/at_exception_stack_test.dart +++ b/at_commons/test/at_exception_stack_test.dart @@ -9,16 +9,12 @@ void main() { Intent.syncData, ExceptionScenario.invalidKeyFormed, 'sync issue'); final exceptionStack = AtExceptionStack(); exceptionStack.add(atChainedException); + print(exceptionStack.getTraceMessage()); expect(exceptionStack.getTraceMessage(), isNotEmpty); expect(exceptionStack.getTraceMessage(), startsWith('Failed to syncData caused by')); }); - test('chained exception list size is zero', () { - final exceptionStack = AtExceptionStack(); - expect(exceptionStack.getTraceMessage(), isEmpty); - }); - test('check intent message', () { final atChainedException = AtChainedException( Intent.syncData, ExceptionScenario.invalidKeyFormed, 'sync issue'); @@ -28,5 +24,69 @@ void main() { expect(exceptionStack.getIntentMessage(Intent.syncData), equals('Failed to syncData')); }); + + test('chained exception list size is zero', () { + final exceptionStack = AtExceptionStack(); + expect(exceptionStack.getTraceMessage(), isEmpty); + }); + + test('no namespace provided - check trace message', () { + final atChainedException = AtChainedException(Intent.validateKey, + ExceptionScenario.noNamespaceProvided, 'name space is not provided'); + final exceptionStack = AtExceptionStack(); + exceptionStack.add(atChainedException); + print(exceptionStack.getTraceMessage()); + expect(exceptionStack.getTraceMessage(), isNotEmpty); + expect(exceptionStack.getTraceMessage(), + startsWith('Failed to validateKey caused by')); + }); + + test('atsign does not exist - check trace message', () { + final atChainedException = AtChainedException(Intent.shareData, + ExceptionScenario.atSignDoesNotExist, 'atsign does not exist'); + final exceptionStack = AtExceptionStack(); + exceptionStack.add(atChainedException); + print(exceptionStack.getTraceMessage()); + expect(exceptionStack.getTraceMessage(), isNotEmpty); + expect(exceptionStack.getTraceMessage(), + startsWith('Failed to shareData caused by')); + }); + + test('Decryption failed - check trace message', () { + final atChainedException = AtChainedException(Intent.decryptData, + ExceptionScenario.decryptionFailed, 'Decryption failed'); + final exceptionStack = AtExceptionStack(); + exceptionStack.add(atChainedException); + print(exceptionStack.getTraceMessage()); + expect(exceptionStack.getTraceMessage(), isNotEmpty); + expect(exceptionStack.getTraceMessage(), + startsWith('Failed to decryptData caused by')); + }); + + test('Encryption private key not found - check trace message', () { + final atChainedException = AtChainedException( + Intent.fetchEncryptionPrivateKey, + ExceptionScenario.fetchEncryptionKeys, + 'Encryption keys not found'); + final exceptionStack = AtExceptionStack(); + exceptionStack.add(atChainedException); + print(exceptionStack.getTraceMessage()); + expect(exceptionStack.getTraceMessage(), isNotEmpty); + expect(exceptionStack.getTraceMessage(), + startsWith('Failed to fetchEncryptionPrivateKey caused by')); + }); + + test('Notification failed - check trace message', () { + final atChainedException = AtChainedException( + Intent.notifyData, + ExceptionScenario.secondaryServerNotReachable, + 'Secondary server not reachable'); + final exceptionStack = AtExceptionStack(); + exceptionStack.add(atChainedException); + print(exceptionStack.getTraceMessage()); + expect(exceptionStack.getTraceMessage(), isNotEmpty); + expect(exceptionStack.getTraceMessage(), + startsWith('Failed to notifyData caused by')); + }); }); } From bfbdb8cd4fc608c6853bff410a0951144bc20feb Mon Sep 17 00:00:00 2001 From: purnimavenkatasubbu Date: Thu, 29 Sep 2022 16:04:14 +0530 Subject: [PATCH 2/3] dummy commit From 9761a954ce004709f1059f931f71ab5fcc101722 Mon Sep 17 00:00:00 2001 From: purnimavenkatasubbu Date: Wed, 19 Oct 2022 14:58:17 +0530 Subject: [PATCH 3/3] removed print statements --- at_commons/test/at_exception_stack_test.dart | 6 ------ 1 file changed, 6 deletions(-) diff --git a/at_commons/test/at_exception_stack_test.dart b/at_commons/test/at_exception_stack_test.dart index a92c7ed5..a150a7dc 100644 --- a/at_commons/test/at_exception_stack_test.dart +++ b/at_commons/test/at_exception_stack_test.dart @@ -9,7 +9,6 @@ void main() { Intent.syncData, ExceptionScenario.invalidKeyFormed, 'sync issue'); final exceptionStack = AtExceptionStack(); exceptionStack.add(atChainedException); - print(exceptionStack.getTraceMessage()); expect(exceptionStack.getTraceMessage(), isNotEmpty); expect(exceptionStack.getTraceMessage(), startsWith('Failed to syncData caused by')); @@ -35,7 +34,6 @@ void main() { ExceptionScenario.noNamespaceProvided, 'name space is not provided'); final exceptionStack = AtExceptionStack(); exceptionStack.add(atChainedException); - print(exceptionStack.getTraceMessage()); expect(exceptionStack.getTraceMessage(), isNotEmpty); expect(exceptionStack.getTraceMessage(), startsWith('Failed to validateKey caused by')); @@ -46,7 +44,6 @@ void main() { ExceptionScenario.atSignDoesNotExist, 'atsign does not exist'); final exceptionStack = AtExceptionStack(); exceptionStack.add(atChainedException); - print(exceptionStack.getTraceMessage()); expect(exceptionStack.getTraceMessage(), isNotEmpty); expect(exceptionStack.getTraceMessage(), startsWith('Failed to shareData caused by')); @@ -57,7 +54,6 @@ void main() { ExceptionScenario.decryptionFailed, 'Decryption failed'); final exceptionStack = AtExceptionStack(); exceptionStack.add(atChainedException); - print(exceptionStack.getTraceMessage()); expect(exceptionStack.getTraceMessage(), isNotEmpty); expect(exceptionStack.getTraceMessage(), startsWith('Failed to decryptData caused by')); @@ -70,7 +66,6 @@ void main() { 'Encryption keys not found'); final exceptionStack = AtExceptionStack(); exceptionStack.add(atChainedException); - print(exceptionStack.getTraceMessage()); expect(exceptionStack.getTraceMessage(), isNotEmpty); expect(exceptionStack.getTraceMessage(), startsWith('Failed to fetchEncryptionPrivateKey caused by')); @@ -83,7 +78,6 @@ void main() { 'Secondary server not reachable'); final exceptionStack = AtExceptionStack(); exceptionStack.add(atChainedException); - print(exceptionStack.getTraceMessage()); expect(exceptionStack.getTraceMessage(), isNotEmpty); expect(exceptionStack.getTraceMessage(), startsWith('Failed to notifyData caused by'));