-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add metadata accessors to BugsnagEvent
Also added a BaseUnitTest to collect common setup patterns.
- Loading branch information
1 parent
1652b85
commit a6ea938
Showing
12 changed files
with
454 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// | ||
// BugsnagBaseUnitTest.h | ||
// Bugsnag | ||
// | ||
// Created by Robin Macharg on 13/02/2020. | ||
// Copyright © 2020 Bugsnag. All rights reserved. | ||
// | ||
// A Unit Test base class that provides useful utility methods. | ||
|
||
#ifndef BugsnagBaseUnitTest_h | ||
#define BugsnagBaseUnitTest_h | ||
|
||
@interface BugsnagBaseUnitTest : XCTestCase | ||
|
||
-(void)setUpBugsnagWillCallNotify:(bool)willNotify; | ||
|
||
@end | ||
|
||
#endif /* BugsnagBaseUnitTest_h */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// | ||
// BugsnagBaseUnitTest.m | ||
// Tests | ||
// | ||
// Created by Robin Macharg on 13/02/2020. | ||
// Copyright © 2020 Bugsnag. All rights reserved. | ||
// | ||
|
||
#import "Bugsnag.h" | ||
#import "BugsnagConfiguration.h" | ||
#import "BugsnagTestConstants.h" | ||
#import <XCTest/XCTest.h> | ||
|
||
@interface BugsnagBaseUnitTest : XCTestCase | ||
|
||
@end | ||
|
||
@implementation BugsnagBaseUnitTest | ||
|
||
/** | ||
* A boilerplate helper method to setup Bugsnag | ||
* If [Bugsnag notify] is to be called during unit testing it should either: | ||
* | ||
* - discard events before sending or | ||
* - send to an arbitrary non-functional endpoint. | ||
* | ||
* We take the former approach. | ||
*/ | ||
-(void)setUpBugsnagWillCallNotify:(bool)willNotify { | ||
NSError *error; | ||
BugsnagConfiguration *configuration = [[BugsnagConfiguration alloc] initWithApiKey:DUMMY_APIKEY_32CHAR_1 error:&error]; | ||
if (willNotify) { | ||
[configuration addBeforeSendBlock:^bool(NSDictionary * _Nonnull rawEventData, | ||
BugsnagEvent * _Nonnull reports) | ||
{ | ||
return false; | ||
}]; | ||
} | ||
[Bugsnag startBugsnagWithConfiguration:configuration]; | ||
} | ||
|
||
@end |
Oops, something went wrong.