Skip to content

Commit

Permalink
feat: add observe plan information support
Browse files Browse the repository at this point in the history
  • Loading branch information
qingzhuozhen committed Sep 21, 2021
1 parent e234434 commit 62e8bab
Show file tree
Hide file tree
Showing 10 changed files with 289 additions and 0 deletions.
28 changes: 28 additions & 0 deletions Amplitude.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,17 @@
12C973CF24131EB100E9CDDB /* SSLPinningTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 12C9731024108DFF00E9CDDB /* SSLPinningTests.m */; };
12DF9471251DAC27008B2C25 /* AmplitudeiOSTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 12C9731A24108DFF00E9CDDB /* AmplitudeiOSTests.m */; };
2FF530703C32718DA15D4013 /* libPods-shared-Amplitude_macOSTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1F8C962279011799CE1B72F5 /* libPods-shared-Amplitude_macOSTests.a */; };
3E2411E726F9A40100793829 /* AMPPlan.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E2411E626F9A40100793829 /* AMPPlan.h */; settings = {ATTRIBUTES = (Public, ); }; };
3E2411E826F9A40100793829 /* AMPPlan.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E2411E626F9A40100793829 /* AMPPlan.h */; settings = {ATTRIBUTES = (Public, ); }; };
3E2411E926F9A40100793829 /* AMPPlan.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E2411E626F9A40100793829 /* AMPPlan.h */; settings = {ATTRIBUTES = (Public, ); }; };
3E2411EA26F9A40100793829 /* AMPPlan.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E2411E626F9A40100793829 /* AMPPlan.h */; settings = {ATTRIBUTES = (Public, ); }; };
3E2411EC26F9A46500793829 /* AMPPlan.m in Sources */ = {isa = PBXBuildFile; fileRef = 3E2411EB26F9A46500793829 /* AMPPlan.m */; };
3E2411ED26F9A46500793829 /* AMPPlan.m in Sources */ = {isa = PBXBuildFile; fileRef = 3E2411EB26F9A46500793829 /* AMPPlan.m */; };
3E2411EE26F9A46500793829 /* AMPPlan.m in Sources */ = {isa = PBXBuildFile; fileRef = 3E2411EB26F9A46500793829 /* AMPPlan.m */; };
3E2411EF26F9A46500793829 /* AMPPlan.m in Sources */ = {isa = PBXBuildFile; fileRef = 3E2411EB26F9A46500793829 /* AMPPlan.m */; };
3E2411F526F9A4E100793829 /* PlanTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3E2411F026F9A4C600793829 /* PlanTests.m */; };
3E2411F626F9A4E200793829 /* PlanTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3E2411F026F9A4C600793829 /* PlanTests.m */; };
3E2411F726F9A4E400793829 /* PlanTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3E2411F026F9A4C600793829 /* PlanTests.m */; };
5864D44A49419C011B0B2E05 /* libPods-shared-Amplitude_iOSTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 196EC1D108A62A030F1B58B1 /* libPods-shared-Amplitude_iOSTests.a */; };
60CA723497169C7F79BE0BF9 /* libPods-shared-Amplitude_tvOSTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = AA18D859F9EB6DDF9522DF6E /* libPods-shared-Amplitude_tvOSTests.a */; };
759E939025FBF3DC00BF7C3D /* AMPConfigManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 1279F8C525244D78003DCE07 /* AMPConfigManager.m */; };
Expand Down Expand Up @@ -279,6 +290,9 @@
196EC1D108A62A030F1B58B1 /* libPods-shared-Amplitude_iOSTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-shared-Amplitude_iOSTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
1EA2FCA6A86070E086933860 /* Pods-shared-Amplitude_iOSTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-shared-Amplitude_iOSTests.release.xcconfig"; path = "Target Support Files/Pods-shared-Amplitude_iOSTests/Pods-shared-Amplitude_iOSTests.release.xcconfig"; sourceTree = "<group>"; };
1F8C962279011799CE1B72F5 /* libPods-shared-Amplitude_macOSTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-shared-Amplitude_macOSTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
3E2411E626F9A40100793829 /* AMPPlan.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AMPPlan.h; sourceTree = "<group>"; };
3E2411EB26F9A46500793829 /* AMPPlan.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AMPPlan.m; sourceTree = "<group>"; };
3E2411F026F9A4C600793829 /* PlanTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PlanTests.m; sourceTree = "<group>"; };
493212CA3C7E8FDA1FDC74E8 /* Pods-shared-Amplitude_macOSTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-shared-Amplitude_macOSTests.release.xcconfig"; path = "Target Support Files/Pods-shared-Amplitude_macOSTests/Pods-shared-Amplitude_macOSTests.release.xcconfig"; sourceTree = "<group>"; };
5F70334CA7CB86ECCCB1472A /* Pods-shared-Amplitude_tvOSTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-shared-Amplitude_tvOSTests.release.xcconfig"; path = "Target Support Files/Pods-shared-Amplitude_tvOSTests/Pods-shared-Amplitude_tvOSTests.release.xcconfig"; sourceTree = "<group>"; };
6174D0A3357C218AF5BDE0FC /* libPods-shared-Amplitude_macOSTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-shared-Amplitude_macOSTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -391,6 +405,7 @@
1279F8BF25244D78003DCE07 /* Amplitude */ = {
isa = PBXGroup;
children = (
3E2411EB26F9A46500793829 /* AMPPlan.m */,
19DD8B8C263B4B9B00CC7188 /* Public */,
759E93DA25FBF6F700BF7C3D /* AMPBackgroundNotifier.h */,
759E93DB25FBF6F700BF7C3D /* AMPBackgroundNotifier.m */,
Expand Down Expand Up @@ -439,6 +454,7 @@
12C9730F24108DFF00E9CDDB /* Tests */ = {
isa = PBXGroup;
children = (
3E2411F026F9A4C600793829 /* PlanTests.m */,
12C9731824108DFF00E9CDDB /* BaseTestCase.h */,
12C9731E24108DFF00E9CDDB /* BaseTestCase.m */,
12C9731924108DFF00E9CDDB /* Amplitude+Test.h */,
Expand Down Expand Up @@ -473,6 +489,7 @@
19DD8B8C263B4B9B00CC7188 /* Public */ = {
isa = PBXGroup;
children = (
3E2411E626F9A40100793829 /* AMPPlan.h */,
1279F8D325244D78003DCE07 /* Amplitude.h */,
1279F8C125244D78003DCE07 /* AMPIdentify.h */,
1279F8DA25244D78003DCE07 /* AMPRevenue.h */,
Expand Down Expand Up @@ -544,6 +561,7 @@
buildActionMask = 2147483647;
files = (
759E942925FBFE9600BF7C3D /* AMPBackgroundNotifier.h in Headers */,
3E2411E826F9A40100793829 /* AMPPlan.h in Headers */,
1279FA7E2525949D003DCE07 /* ISPCertificatePinning.h in Headers */,
1213D89C24176E4700300E98 /* AmplitudeFramework.h in Headers */,
1279F91225244E8E003DCE07 /* Amplitude+SSLPinning.h in Headers */,
Expand All @@ -569,6 +587,7 @@
buildActionMask = 2147483647;
files = (
759E942125FBFE9200BF7C3D /* AMPBackgroundNotifier.h in Headers */,
3E2411E726F9A40100793829 /* AMPPlan.h in Headers */,
1279FA7D2525949D003DCE07 /* ISPCertificatePinning.h in Headers */,
1213D89B24176E4700300E98 /* AmplitudeFramework.h in Headers */,
1279F8F425244E8D003DCE07 /* Amplitude+SSLPinning.h in Headers */,
Expand All @@ -594,6 +613,7 @@
buildActionMask = 2147483647;
files = (
1279FA7F2525949D003DCE07 /* ISPCertificatePinning.h in Headers */,
3E2411E926F9A40100793829 /* AMPPlan.h in Headers */,
1213D89D24176E4700300E98 /* AmplitudeFramework.h in Headers */,
1279F93025244E8F003DCE07 /* Amplitude+SSLPinning.h in Headers */,
1279FA7C2525949D003DCE07 /* ISPPinnedNSURLSessionDelegate.h in Headers */,
Expand All @@ -619,6 +639,7 @@
buildActionMask = 2147483647;
files = (
759E93BC25FBF4B600BF7C3D /* AmplitudeFramework.h in Headers */,
3E2411EA26F9A40100793829 /* AMPPlan.h in Headers */,
759E93AB25FBF44500BF7C3D /* Amplitude+SSLPinning.h in Headers */,
759E93AA25FBF44500BF7C3D /* Amplitude.h in Headers */,
759E93AE25FBF44500BF7C3D /* AMPTrackingOptions.h in Headers */,
Expand Down Expand Up @@ -979,6 +1000,7 @@
1279F92525244E8E003DCE07 /* AMPDeviceInfo.m in Sources */,
1279F91D25244E8E003DCE07 /* AMPTrackingOptions.m in Sources */,
1279FA782525949D003DCE07 /* ISPPinnedNSURLSessionDelegate.m in Sources */,
3E2411ED26F9A46500793829 /* AMPPlan.m in Sources */,
1279F91C25244E8E003DCE07 /* AMPRevenue.m in Sources */,
1279F91F25244E8E003DCE07 /* AMPURLSession.m in Sources */,
);
Expand All @@ -996,6 +1018,7 @@
12C973AA241244AE00E9CDDB /* Amplitude+Test.m in Sources */,
12C973B2241244BF00E9CDDB /* RevenueTests.m in Sources */,
12C973C4241244F000E9CDDB /* BaseTestCase.m in Sources */,
3E2411F626F9A4E200793829 /* PlanTests.m in Sources */,
12C973BD241244E400E9CDDB /* SessionTests.m in Sources */,
12C973AD241244B700E9CDDB /* AmplitudeTests.m in Sources */,
12C973C2241244F000E9CDDB /* TrackingOptionsTest.m in Sources */,
Expand All @@ -1009,6 +1032,7 @@
759E941925FBFE7900BF7C3D /* AMPBackgroundNotifier.m in Sources */,
1279F8FE25244E8D003DCE07 /* AMPRevenue.m in Sources */,
1279F90825244E8D003DCE07 /* AMPDatabaseHelper.m in Sources */,
3E2411EC26F9A46500793829 /* AMPPlan.m in Sources */,
1279F8FC25244E8D003DCE07 /* AMPUtils.m in Sources */,
1279F8F125244E8D003DCE07 /* AMPConfigManager.m in Sources */,
1279F8FD25244E8D003DCE07 /* AMPIdentify.m in Sources */,
Expand Down Expand Up @@ -1037,6 +1061,7 @@
12C973A9241244AE00E9CDDB /* Amplitude+Test.m in Sources */,
12C973B0241244BE00E9CDDB /* RevenueTests.m in Sources */,
12C973C1241244EF00E9CDDB /* BaseTestCase.m in Sources */,
3E2411F526F9A4E100793829 /* PlanTests.m in Sources */,
12C973BC241244E300E9CDDB /* SessionTests.m in Sources */,
12C973AC241244B700E9CDDB /* AmplitudeTests.m in Sources */,
12C973BF241244EF00E9CDDB /* TrackingOptionsTest.m in Sources */,
Expand All @@ -1060,6 +1085,7 @@
1279F94325244E8F003DCE07 /* AMPDeviceInfo.m in Sources */,
1279F93B25244E8F003DCE07 /* AMPTrackingOptions.m in Sources */,
1279FA792525949D003DCE07 /* ISPPinnedNSURLSessionDelegate.m in Sources */,
3E2411EE26F9A46500793829 /* AMPPlan.m in Sources */,
1279F93A25244E8F003DCE07 /* AMPRevenue.m in Sources */,
1279F93D25244E8F003DCE07 /* AMPURLSession.m in Sources */,
);
Expand All @@ -1070,6 +1096,7 @@
buildActionMask = 2147483647;
files = (
12C973B7241244C700E9CDDB /* SetupTests.m in Sources */,
3E2411F726F9A4E400793829 /* PlanTests.m in Sources */,
12C973C6241244F100E9CDDB /* IdentifyTests.m in Sources */,
12C973A8241244A700E9CDDB /* DeviceInfoTests.m in Sources */,
12C973B3241244BF00E9CDDB /* AMPDatabaseHelperTests.m in Sources */,
Expand Down Expand Up @@ -1099,6 +1126,7 @@
759E939925FBF3DC00BF7C3D /* AMPURLSession.m in Sources */,
759E939A25FBF3DC00BF7C3D /* AMPUtils.m in Sources */,
759E939B25FBF3DC00BF7C3D /* ISPCertificatePinning.m in Sources */,
3E2411EF26F9A46500793829 /* AMPPlan.m in Sources */,
759E939C25FBF3DC00BF7C3D /* ISPPinnedNSURLConnectionDelegate.m in Sources */,
759E939D25FBF3DC00BF7C3D /* ISPPinnedNSURLSessionDelegate.m in Sources */,
);
Expand Down
1 change: 1 addition & 0 deletions Framework/AmplitudeFramework.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
#import <Amplitude/AMPRevenue.h>
#import <Amplitude/AMPTrackingOptions.h>
#import <Amplitude/Amplitude+SSLPinning.h>
#import <Amplitude/AMPPlan.h>
5 changes: 5 additions & 0 deletions Sources/Amplitude/AMPConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,8 @@ extern NSString *const AMP_TRACKING_OPTION_OS_VERSION;
extern NSString *const AMP_TRACKING_OPTION_PLATFORM;
extern NSString *const AMP_TRACKING_OPTION_REGION;
extern NSString *const AMP_TRACKING_OPTION_VERSION_NAME;

// Plan
extern NSString *const AMP_PLAN_BRANCH;
extern NSString *const AMP_PLAN_SOURCE;
extern NSString *const AMP_PLAN_VERSION;
4 changes: 4 additions & 0 deletions Sources/Amplitude/AMPConstants.m
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,7 @@
NSString *const AMP_TRACKING_OPTION_PLATFORM = @"platform";
NSString *const AMP_TRACKING_OPTION_REGION = @"region";
NSString *const AMP_TRACKING_OPTION_VERSION_NAME = @"version_name";

NSString *const AMP_PLAN_BRANCH = @"branch";
NSString *const AMP_PLAN_SOURCE = @"source";
NSString *const AMP_PLAN_VERSION = @"version";
89 changes: 89 additions & 0 deletions Sources/Amplitude/AMPPlan.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
//
// AMPPlan.m
// Copyright (c) 2021 Amplitude Inc. (https://amplitude.com/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//

#ifndef AMPLITUDE_LOG
#if AMPLITUDE_DEBUG
# define AMPLITUDE_LOG(fmt, ...) NSLog(fmt, ##__VA_ARGS__)
#else
# define AMPLITUDE_LOG(...)
#endif
#endif

#import "AMPPlan.h"
#import "AMPConstants.h"
#import "AMPUtils.h"

@implementation AMPPlan

/*
* Create an AMPPlan object
*/
+ (instancetype)plan {
return [[self alloc] init];
}

- (AMPPlan *)setBranch:(NSString *)branch {
if ([AMPUtils isEmptyString:branch]) {
AMPLITUDE_LOG(@"Invalid empty branch");
return self;
}

_branch = branch;
return self;
}

- (AMPPlan *)setSource:(NSString *)source {
if ([AMPUtils isEmptyString:source]) {
AMPLITUDE_LOG(@"Invalid empty source");
return self;
}

_source = source;
return self;
}

- (AMPPlan *)setVersion:(NSString *)version {
if ([AMPUtils isEmptyString:version]) {
AMPLITUDE_LOG(@"Invalid empty version");
return self;
}

_version = version;
return self;
}

- (NSDictionary *)toNSDictionary {
NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
if (_branch) {
[dict setValue:_branch forKey:AMP_PLAN_BRANCH];
}
if (_source) {
[dict setValue:_source forKey:AMP_PLAN_SOURCE];
}
if (_version) {
[dict setValue:_version forKey:AMP_PLAN_VERSION];
}
return dict;
}

@end
10 changes: 10 additions & 0 deletions Sources/Amplitude/Amplitude.m
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
#import "AMPIdentify.h"
#import "AMPRevenue.h"
#import "AMPTrackingOptions.h"
#import "AMPPlan.h"
#import <math.h>
#import <CommonCrypto/CommonDigest.h>

Expand Down Expand Up @@ -133,6 +134,7 @@ @implementation Amplitude {

NSString *_serverUrl;
NSString *_token;
AMPPlan *_plan;
}

#pragma clang diagnostic push
Expand Down Expand Up @@ -658,6 +660,10 @@ - (void)annotateEvent:(NSMutableDictionary *)event {
[event setValue:library forKey:@"library"];
[event setValue:[AMPUtils generateUUID] forKey:@"uuid"];
[event setValue:[NSNumber numberWithLongLong:[self getNextSequenceNumber]] forKey:@"sequence_number"];

if (_plan) {
[event setValue:[_plan toNSDictionary] forKey:@"plan"];
}

NSMutableDictionary *apiProperties = [event valueForKey:@"api_properties"];

Expand Down Expand Up @@ -1422,6 +1428,10 @@ - (void)useAdvertisingIdForDeviceId {
_useAdvertisingIdForDeviceId = YES;
}

- (void)setPlan:(AMPPlan *)plan {
_plan = plan;
}

#pragma mark - Getters for device data
- (NSString *)getAdSupportID {
NSString *result = nil;
Expand Down
43 changes: 43 additions & 0 deletions Sources/Amplitude/Public/AMPPlan.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
//
// AMPPlan.h
// Copyright (c) 2021 Amplitude Inc. (https://amplitude.com/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#import <Foundation/Foundation.h>

@interface AMPPlan : NSObject

@property (nonatomic, strong, readonly) NSString *branch;

@property (nonatomic, strong, readonly) NSString *source;

@property (nonatomic, strong, readonly) NSString *version;

+ (instancetype)plan;

- (AMPPlan *)setBranch:(NSString *)branch;

- (AMPPlan *)setSource:(NSString *)source;

- (AMPPlan *)setVersion:(NSString *)version;

- (NSDictionary *)toNSDictionary;

@end
3 changes: 3 additions & 0 deletions Sources/Amplitude/Public/Amplitude.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#import "AMPIdentify.h"
#import "AMPRevenue.h"
#import "AMPTrackingOptions.h"
#import "AMPPlan.h"

NS_ASSUME_NONNULL_BEGIN

Expand Down Expand Up @@ -635,6 +636,8 @@ typedef void (^AMPInitCompletionBlock)(void);

- (void)setBearerToken:(NSString *)token;

- (void)setPlan:(AMPPlan *)plan;

/**-----------------------------------------------------------------------------
* @name Other Methods
* -----------------------------------------------------------------------------
Expand Down
20 changes: 20 additions & 0 deletions Tests/AmplitudeTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#import "AMPDeviceInfo.h"
#import "AMPUtils.h"
#import "AMPTrackingOptions.h"
#import "AMPPlan.h"

@interface Amplitude (Tests)

Expand Down Expand Up @@ -1086,4 +1087,23 @@ - (void)testCustomizedLibraryWithNilLibraryAndVersion {
XCTAssertEqualObjects(currentLibraryValue, targetLibraryValue);
}

- (void)testSetPlan {
Amplitude *client = [Amplitude instanceWithName:@"observe_plan"];
[client initializeApiKey:@"tracking_plan"];
NSString *branch = @"main";
NSString *source = @"mobile";
NSString *version = @"1.0.0";

AMPPlan *plan = [[[[AMPPlan plan] setBranch:branch] setSource:source] setVersion:version];
[client setPlan:plan];
[client logEvent:@"test"];
[client flushQueue];
NSDictionary *event = [client getLastEventFromInstanceName:@"observe_plan"];

NSDictionary *planValue = event[@"plan"];
XCTAssertEqualObjects(branch, planValue[@"branch"]);
XCTAssertEqualObjects(source, planValue[@"source"]);
XCTAssertEqualObjects(version, planValue[@"version"]);
}

@end
Loading

0 comments on commit 62e8bab

Please sign in to comment.