react-native-firebase/bridge/e2e/crashlytics/crashlytics.e2e.js

73 lines
2.2 KiB
JavaScript

describe('crashlytics()', () => {
describe('crash()', () => {
it('should force an app crash', async () => {
await firebase.crashlytics().crash();
if (device.getPlatform() === 'ios') {
// ios responds quicker after a fatal exception if we re-install
await device.uninstallApp();
await device.installApp();
}
await device.launchApp({ newInstance: true });
await firebase.crashlytics().log('app relaunched from a crash');
});
});
describe('log()', () => {
it('should set a string value', async () => {
await firebase.crashlytics().log('123abc');
});
xit('should error on a non a string value', async () => {
// TODO lib needs validations adding
await firebase.crashlytics().log(123456);
});
});
describe('recordError()', () => {
it('should record an error with a code and message', async () => {
await firebase.crashlytics().recordError(1234, 'Test error');
});
xit('should error on invalid args', async () => {
// TODO lib needs validations adding - and this should technically take an instance of Error only
await firebase.crashlytics().recordError({}, []);
});
});
describe('setBoolValue()', () => {
it('should set a boolean value', async () => {
await firebase.crashlytics().setBoolValue('boolKey', true);
});
});
describe('setFloatValue()', () => {
it('should set a float value', async () => {
await firebase.crashlytics().setFloatValue('floatKey', 1.23);
});
});
describe('setIntValue()', () => {
it('should set a integer value', async () => {
await firebase.crashlytics().setIntValue('intKey', 123);
});
});
describe('setStringValue()', () => {
it('should set a string value', async () => {
await firebase.crashlytics().setStringValue('stringKey', 'test');
});
});
describe('setUserIdentifier()', () => {
it('should set a string value', async () => {
await firebase.crashlytics().setUserIdentifier('123abc');
});
xit('should error on a non a string value', async () => {
// TODO lib needs validations adding
await firebase.crashlytics().setUserIdentifier(123456);
});
});
});