mirror of
https://github.com/mosip/inji-wallet.git
synced 2026-01-09 21:48:04 -05:00
INJIMOB-3246 Code coverage for Inji-Wallet repo increase above 5% (#2108)
* INJIMOB-3246 Code coverage for Inji-Wallet repo increase above 5% Signed-off-by: Kaushik Gupta <kausgpt97@gmail.com> * INJIMOB-3246: added snapshot tests and coverage increased to +4% Signed-off-by: Kaushik Gupta <kausgpt97@gmail.com> * removed duplicated lines Signed-off-by: Kaushik Gupta <kausgpt97@gmail.com> * Added updateCredentialInformation tests Signed-off-by: Kaushik Gupta <kausgpt97@gmail.com> * added code rabbit changes Signed-off-by: Kaushik Gupta <kausgpt97@gmail.com> * removed platform-specific tests without mocking Signed-off-by: Kaushik Gupta <kausgpt97@gmail.com> * standardize mocks in VcItemContainerProfileImage tests Signed-off-by: Kaushik Gupta <kausgpt97@gmail.com> --------- Signed-off-by: Kaushik Gupta <kausgpt97@gmail.com>
This commit is contained in:
31
shared/error/BiometricCancellationError.test.ts
Normal file
31
shared/error/BiometricCancellationError.test.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import {BiometricCancellationError} from './BiometricCancellationError';
|
||||
|
||||
describe('BiometricCancellationError', () => {
|
||||
it('should create an error instance with the correct message', () => {
|
||||
const errorMessage = 'User cancelled biometric authentication';
|
||||
const error = new BiometricCancellationError(errorMessage);
|
||||
|
||||
expect(error).toBeInstanceOf(Error);
|
||||
expect(error).toBeInstanceOf(BiometricCancellationError);
|
||||
expect(error.message).toBe(errorMessage);
|
||||
});
|
||||
|
||||
it('should have the correct error name', () => {
|
||||
const error = new BiometricCancellationError('Test error');
|
||||
|
||||
expect(error.name).toBe('BiometricCancellationError');
|
||||
});
|
||||
|
||||
it('should maintain the error stack trace', () => {
|
||||
const error = new BiometricCancellationError('Stack trace test');
|
||||
|
||||
expect(error.stack).toBeDefined();
|
||||
});
|
||||
|
||||
it('should handle empty message', () => {
|
||||
const error = new BiometricCancellationError('');
|
||||
|
||||
expect(error.message).toBe('');
|
||||
expect(error.name).toBe('BiometricCancellationError');
|
||||
});
|
||||
});
|
||||
38
shared/error/UnsupportedVCFormat.test.ts
Normal file
38
shared/error/UnsupportedVCFormat.test.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import {UnsupportedVcFormat} from './UnsupportedVCFormat';
|
||||
|
||||
describe('UnsupportedVcFormat', () => {
|
||||
it('should create an error instance with the correct format message', () => {
|
||||
const format = 'jwt_vc_json';
|
||||
const error = new UnsupportedVcFormat(format);
|
||||
|
||||
expect(error).toBeInstanceOf(Error);
|
||||
expect(error).toBeInstanceOf(UnsupportedVcFormat);
|
||||
expect(error.message).toBe(format);
|
||||
});
|
||||
|
||||
it('should have the correct error name', () => {
|
||||
const error = new UnsupportedVcFormat('ldp_vc');
|
||||
|
||||
expect(error.name).toBe('UnsupportedVcFormat');
|
||||
});
|
||||
|
||||
it('should maintain the error stack trace', () => {
|
||||
const error = new UnsupportedVcFormat('custom_format');
|
||||
|
||||
expect(error.stack).toBeDefined();
|
||||
});
|
||||
|
||||
it('should handle empty format string', () => {
|
||||
const error = new UnsupportedVcFormat('');
|
||||
|
||||
expect(error.message).toBe('');
|
||||
expect(error.name).toBe('UnsupportedVcFormat');
|
||||
});
|
||||
|
||||
it('should handle complex format strings', () => {
|
||||
const format = 'application/vc+sd-jwt';
|
||||
const error = new UnsupportedVcFormat(format);
|
||||
|
||||
expect(error.message).toBe(format);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user