Skip to content

Commit

Permalink
Removing invalid type (#22023)
Browse files Browse the repository at this point in the history
  • Loading branch information
woody-apple authored and pull[bot] committed Aug 19, 2022
1 parent ceb076f commit 3375167
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 34 deletions.
3 changes: 1 addition & 2 deletions src/darwin/Framework/CHIP/MTROnboardingPayloadParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSUInteger, MTROnboardingPayloadType) {
MTROnboardingPayloadTypeQRCode = 0,
MTROnboardingPayloadTypeManualCode,
MTROnboardingPayloadTypeNFC,
MTROnboardingPayloadTypeAdmin,
MTROnboardingPayloadTypeNFC
};

@interface MTROnboardingPayloadParser : NSObject
Expand Down
1 change: 0 additions & 1 deletion src/darwin/Framework/CHIP/MTROnboardingPayloadParser.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ + (nullable MTRSetupPayload *)setupPayloadForOnboardingPayload:(NSString *)onboa
MTRSetupPayload * payload;
switch (type) {
case MTROnboardingPayloadTypeManualCode:
case MTROnboardingPayloadTypeAdmin:
payload = [self setupPayloadForManualCodeOnboardingPayload:onboardingPayload error:error];
break;
case MTROnboardingPayloadTypeQRCode:
Expand Down
31 changes: 0 additions & 31 deletions src/darwin/Framework/CHIPTests/MTRSetupPayloadParserTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -66,26 +66,6 @@ - (void)testOnboardingPayloadParser_Manual_WrongType
XCTAssertEqual(error.code, MTRErrorCodeInvalidArgument);
}

- (void)testOnboardingPayloadParser_Admin_NoError
{
NSError * error;
MTRSetupPayload * payload = [MTROnboardingPayloadParser setupPayloadForOnboardingPayload:@"636108753500001000015"
ofType:MTROnboardingPayloadTypeAdmin
error:&error];

XCTAssertNotNil(payload);
XCTAssertNil(error);

XCTAssertTrue(payload.hasShortDiscriminator);
XCTAssertEqual(payload.discriminator.unsignedIntegerValue, 10);
XCTAssertEqual(payload.setUpPINCode.unsignedIntegerValue, 123456780);
XCTAssertEqual(payload.vendorID.unsignedIntegerValue, 1);
XCTAssertEqual(payload.productID.unsignedIntegerValue, 1);
XCTAssertEqual(payload.commissioningFlow, MTRCommissioningFlowCustom);
XCTAssertEqual(payload.version.unsignedIntegerValue, 0);
XCTAssertNil(payload.rendezvousInformation);
}

- (void)testOnboardingPayloadParser_Admin_WrongType
{
NSError * error;
Expand Down Expand Up @@ -118,17 +98,6 @@ - (void)testOnboardingPayloadParser_QRCode_NoError
XCTAssertEqual([payload.rendezvousInformation unsignedLongValue], MTRDiscoveryCapabilitiesSoftAP);
}

- (void)testOnboardingPayloadParser_QRCode_WrongType
{
NSError * error;
MTRSetupPayload * payload = [MTROnboardingPayloadParser setupPayloadForOnboardingPayload:@"MT:R5L90MP500K64J00000"
ofType:MTROnboardingPayloadTypeAdmin
error:&error];

XCTAssertNil(payload);
XCTAssertEqual(error.code, MTRErrorCodeIntegrityCheckFailed);
}

- (void)testOnboardingPayloadParser_NFC_NoError
{
NSError * error;
Expand Down

0 comments on commit 3375167

Please sign in to comment.