Skip to content

Commit fdc8a20

Browse files
committed
fix: removed unused tests
1 parent 3bcf21f commit fdc8a20

File tree

8 files changed

+3
-331
lines changed

8 files changed

+3
-331
lines changed

android/src/main/java/com/instabug/reactlibrary/RNInstabugAPMModule.java

Lines changed: 0 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -207,81 +207,6 @@ public void run() {
207207
});
208208
}
209209

210-
/**
211-
* Starts an execution trace
212-
*
213-
* @param name string name of the trace.
214-
*
215-
* @deprecated see {@link #startFlow(String)}
216-
*/
217-
@Deprecated
218-
@ReactMethod
219-
public void startExecutionTrace(final String name, final String id, final Promise promise) {
220-
MainThreadHandler.runOnMainThread(new Runnable() {
221-
@Override
222-
public void run() {
223-
try {
224-
String result = "";
225-
ExecutionTrace trace = APM.startExecutionTrace(name);
226-
if (trace != null) {
227-
result = id;
228-
traces.put(id, trace);
229-
}
230-
promise.resolve(result);
231-
} catch (Exception e) {
232-
e.printStackTrace();
233-
promise.resolve(null);
234-
}
235-
}
236-
});
237-
}
238-
239-
/**
240-
* Adds a new attribute to trace
241-
*
242-
* @param id String id of the trace.
243-
* @param key attribute key
244-
* @param value attribute value. Null to remove attribute
245-
*
246-
* @deprecated see {@link #setFlowAttribute}
247-
*/
248-
@Deprecated
249-
@ReactMethod
250-
public void setExecutionTraceAttribute(final String id, final String key, final String value) {
251-
MainThreadHandler.runOnMainThread(new Runnable() {
252-
@Override
253-
public void run() {
254-
try {
255-
traces.get(id).setAttribute(key, value);
256-
} catch (Exception e) {
257-
e.printStackTrace();
258-
}
259-
}
260-
});
261-
}
262-
263-
/**
264-
* Ends a trace
265-
*
266-
* @param id string id of the trace.
267-
*
268-
* @deprecated see {@link #endFlow}
269-
*/
270-
@Deprecated
271-
@ReactMethod
272-
public void endExecutionTrace(final String id) {
273-
MainThreadHandler.runOnMainThread(new Runnable() {
274-
@Override
275-
public void run() {
276-
try {
277-
traces.get(id).end();
278-
} catch (Exception e) {
279-
e.printStackTrace();
280-
}
281-
}
282-
});
283-
}
284-
285210
/**
286211
* Starts a UI trace
287212
*

android/src/main/java/com/instabug/reactlibrary/RNInstabugBugReportingModule.java

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -390,34 +390,6 @@ public void run() {
390390
});
391391
}
392392

393-
/**
394-
* Sets a minimum number of characters as a requirement for the comments field in the different report types.
395-
* @param limit int number of characters.
396-
* @param reportTypes (Optional) Array of reportType. If it's not passed, the limit will apply to all report types.
397-
*/
398-
@ReactMethod
399-
public void setCommentMinimumCharacterCount(final int limit, final ReadableArray reportTypes){
400-
MainThreadHandler.runOnMainThread(new Runnable() {
401-
@SuppressLint("WrongConstant")
402-
@Override
403-
public void run() {
404-
try {
405-
final ArrayList<String> keys = ArrayUtil.parseReadableArrayOfStrings(reportTypes);
406-
final ArrayList<Integer> types = ArgsRegistry.reportTypes.getAll(keys);
407-
408-
final int[] typesInts = new int[types.size()];
409-
for (int i = 0; i < types.size(); i++) {
410-
typesInts[i] = types.get(i);
411-
}
412-
413-
BugReporting.setCommentMinimumCharacterCount(limit, typesInts);
414-
} catch (Exception e) {
415-
e.printStackTrace();
416-
}
417-
}
418-
});
419-
}
420-
421393
/**
422394
* Adds a user consent item to the bug reporting
423395
* @param key A unique identifier string for the consent item.

android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java

Lines changed: 1 addition & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -281,26 +281,6 @@ public void run() {
281281
});
282282
}
283283

284-
/**
285-
* Set the primary color that the SDK will use to tint certain UI elements in the SDK
286-
*
287-
* @param primaryColor The value of the primary color ,
288-
* whatever this color was parsed from a resource color or hex color
289-
* or RGB color values
290-
*/
291-
@ReactMethod
292-
public void setPrimaryColor(final int primaryColor) {
293-
MainThreadHandler.runOnMainThread(new Runnable() {
294-
@Override
295-
public void run() {
296-
try {
297-
Instabug.setPrimaryColor(primaryColor);
298-
} catch (Exception e) {
299-
e.printStackTrace();
300-
}
301-
}
302-
});
303-
}
304284

305285
/**
306286
* Gets tags.
@@ -1036,60 +1016,7 @@ public void run() {
10361016
});
10371017
}
10381018

1039-
/**
1040-
* @deprecated see {@link #addFeatureFlags(ReadableArray)}
1041-
*/
1042-
@ReactMethod
1043-
public void addExperiments(final ReadableArray experiments) {
1044-
MainThreadHandler.runOnMainThread(new Runnable() {
1045-
@Override
1046-
public void run() {
1047-
try {
1048-
Object[] objectArray = ArrayUtil.toArray(experiments);
1049-
String[] stringArray = Arrays.copyOf(objectArray, objectArray.length, String[].class);
1050-
Instabug.addExperiments(Arrays.asList(stringArray));
1051-
} catch (Exception e) {
1052-
e.printStackTrace();
1053-
}
1054-
}
1055-
});
1056-
}
1057-
1058-
/**
1059-
* @deprecated see {@link #removeFeatureFlags(ReadableArray)}
1060-
*/
1061-
@ReactMethod
1062-
public void removeExperiments(final ReadableArray experiments) {
1063-
MainThreadHandler.runOnMainThread(new Runnable() {
1064-
@Override
1065-
public void run() {
1066-
try {
1067-
Object[] objectArray = ArrayUtil.toArray(experiments);
1068-
String[] stringArray = Arrays.copyOf(objectArray, objectArray.length, String[].class);
1069-
Instabug.removeExperiments(Arrays.asList(stringArray));
1070-
} catch (Exception e) {
1071-
e.printStackTrace();
1072-
}
1073-
}
1074-
});
1075-
}
1076-
1077-
/**
1078-
* @deprecated see {@link #removeAllFeatureFlags()}
1079-
*/
1080-
@ReactMethod
1081-
public void clearAllExperiments() {
1082-
MainThreadHandler.runOnMainThread(new Runnable() {
1083-
@Override
1084-
public void run() {
1085-
try {
1086-
Instabug.clearAllExperiments();
1087-
} catch (Exception e) {
1088-
e.printStackTrace();
1089-
}
1090-
}
1091-
});
1092-
}
1019+
10931020

10941021
@ReactMethod
10951022
public void addFeatureFlags(final ReadableMap featureFlagsMap) {

android/src/test/java/com/instabug/reactlibrary/RNInstabugBugReportingModuleTest.java

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -344,24 +344,7 @@ public Object answer(InvocationOnMock invocation) {
344344
BugReporting.setDisclaimerText(text);
345345
}
346346

347-
@Test
348-
public void givenArgs$setCommentMinimumCharacterCount_whenQuery_thenShouldCallNativeApiWithArgs() {
349-
// given
350-
final int count = 20;
351-
final Map<String, Integer> args = ArgsRegistry.reportTypes;
352-
final String[] keysArray = args.keySet().toArray(new String[0]);
353-
JavaOnlyArray actualArray = new JavaOnlyArray();
354-
actualArray.pushString(keysArray[0]);
355-
356-
// when
357-
bugReportingModule.setCommentMinimumCharacterCount(count, actualArray);
358-
359-
// then
360-
verify(BugReporting.class, VerificationModeFactory.times(1));
361-
int type1 = args.get(keysArray[0]);
362-
363-
BugReporting.setCommentMinimumCharacterCount(count, type1);
364-
}
347+
365348
@Test
366349
public void TestAddUserConsent() {
367350
final Map<String, String> args = ArgsRegistry.userConsentActionType;

android/src/test/java/com/instabug/reactlibrary/RNInstabugReactnativeModuleTest.java

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -193,18 +193,6 @@ public void tearDown() {
193193
Instabug.setUserData(data);
194194
}
195195

196-
@Test
197-
public void givenArg$setPrimaryColor_whenQuery_thenShouldCallNativeApiWithArg() {
198-
// given
199-
200-
int color = 3902;
201-
// when
202-
rnModule.setPrimaryColor(color);
203-
// then
204-
verify(Instabug.class,times(1));
205-
Instabug.setPrimaryColor(color);
206-
}
207-
208196
@Test
209197
public void testSetCodePushVersion() {
210198
String codePushVersion = "123";
@@ -535,24 +523,7 @@ public void testIdentifyUserWithId() {
535523

536524
}
537525

538-
@Test
539-
public void givenArg$addExperiments_whenQuery_thenShouldCallNativeApiWithArg() {
540-
// given
541-
JavaOnlyArray array = new JavaOnlyArray();
542-
array.pushString("exp1");
543-
array.pushString("exp2");
544-
545-
// when
546-
rnModule.addExperiments(array);
547-
548-
// then
549-
verify(Instabug.class,times(1));
550-
List<String> expectedList = new ArrayList<String>();
551-
expectedList.add("exp1");
552-
expectedList.add("exp2");
553-
Instabug.addExperiments(expectedList);
554-
}
555-
526+
556527
@Test
557528
public void givenArg$removeExperiments_whenQuery_thenShouldCallNativeApiWithArg() {
558529
// given
@@ -571,16 +542,6 @@ public void testIdentifyUserWithId() {
571542
Instabug.removeExperiments(expectedList);
572543
}
573544

574-
@Test
575-
public void given$clearAllExperiments_whenQuery_thenShouldCallNativeApi() {
576-
// when
577-
rnModule.clearAllExperiments();
578-
579-
// then
580-
verify(Instabug.class,times(1));
581-
Instabug.clearAllExperiments();
582-
}
583-
584545
@Test
585546
public void testAddFeatureFlags() {
586547
// given

examples/default/ios/InstabugTests/InstabugAPMTests.m

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -86,53 +86,6 @@ - (void) testSetAutoUITraceEnabled {
8686
OCMVerify([mock setAutoUITraceEnabled:isEnabled]);
8787
}
8888

89-
- (void) testStartExecutionTrace {
90-
id mock = OCMClassMock([IBGAPM class]);
91-
NSString* traceName = @"Trace_1";
92-
NSString* traceKey = @"1";
93-
RCTPromiseResolveBlock resolve = ^(id result) {};
94-
RCTPromiseRejectBlock reject = ^(NSString *code, NSString *message, NSError *error) {};
95-
96-
OCMStub([mock startExecutionTraceWithName:traceName]);
97-
[self.instabugBridge startExecutionTrace:traceName :traceKey :resolve :reject];
98-
OCMVerify([mock startExecutionTraceWithName:traceName]);
99-
}
100-
101-
- (void) testSetExecutionTraceAttribute {
102-
NSString* traceName = @"Trace_1";
103-
NSString* traceId = @"Id_1";
104-
NSString* traceKey = @"Key_1";
105-
NSString* traceValue = @"1";
106-
RCTPromiseResolveBlock resolve = ^(id result) {};
107-
RCTPromiseRejectBlock reject = ^(NSString *code, NSString *message, NSError *error) {};
108-
IBGExecutionTrace * trace = [IBGExecutionTrace alloc];
109-
id mock = OCMClassMock([IBGAPM class]);
110-
id traceMock = OCMPartialMock(trace);
111-
112-
OCMStub([mock startExecutionTraceWithName:traceName]).andReturn(trace);
113-
[self.instabugBridge startExecutionTrace:traceName :traceId :resolve :reject];
114-
115-
OCMStub([traceMock setAttributeWithKey:traceKey value:traceValue]);
116-
[self.instabugBridge setExecutionTraceAttribute:traceId :traceKey :traceValue];
117-
OCMVerify([traceMock setAttributeWithKey:traceKey value:traceValue]);
118-
}
119-
120-
- (void) testEndExecutionTrace {
121-
NSString* traceName = @"Trace_1";
122-
NSString* traceId = @"Id_1";
123-
RCTPromiseResolveBlock resolve = ^(id result) {};
124-
RCTPromiseRejectBlock reject = ^(NSString *code, NSString *message, NSError *error) {};
125-
IBGExecutionTrace * trace = [IBGExecutionTrace alloc];
126-
id apmMock = OCMClassMock([IBGAPM class]);
127-
id<ExecutionTraceCPTestProtocol> traceMock = OCMPartialMock(trace);
128-
129-
OCMStub([apmMock startExecutionTraceWithName:traceName]).andReturn(trace);
130-
[self.instabugBridge startExecutionTrace:traceName :traceId :resolve :reject];
131-
132-
OCMStub([traceMock end]);
133-
[self.instabugBridge endExecutionTrace:traceId];
134-
OCMVerify([traceMock end]);
135-
}
13689

13790
- (void) testStartFlow {
13891
id mock = OCMClassMock([IBGAPM class]);

examples/default/ios/InstabugTests/InstabugBugReportingTests.m

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -175,18 +175,6 @@ - (void) testSetDisclaimerText {
175175
OCMVerify([mock setDisclaimerText:text]);
176176
}
177177

178-
- (void) testSetCommentMinimumCharacterCount {
179-
id mock = OCMClassMock([IBGBugReporting class]);
180-
NSNumber *limit = [NSNumber numberWithInt:20];
181-
NSArray *reportTypesArr = [NSArray arrayWithObjects: @(IBGReportTypeBug), nil];
182-
IBGBugReportingReportType reportTypes = 0;
183-
for (NSNumber *reportType in reportTypesArr) {
184-
reportTypes |= [reportType intValue];
185-
}
186-
OCMStub([mock setCommentMinimumCharacterCountForReportTypes:reportTypes withLimit:limit.intValue]);
187-
[self.instabugBridge setCommentMinimumCharacterCount:limit reportTypes:reportTypesArr];
188-
OCMVerify([mock setCommentMinimumCharacterCountForReportTypes:reportTypes withLimit:limit.intValue]);
189-
}
190178
- (void)testAddUserConsentWithKey {
191179
id mock = OCMClassMock([IBGBugReporting class]);
192180

0 commit comments

Comments
 (0)