@@ -3082,6 +3082,7 @@ + (void)checkAttributeReportTriggersConfigurationChanged:(MTRAttributeIDType)att
3082
3082
XCTestExpectation * gotAttributeReportExpectation = [testcase expectationWithDescription: @" Attribute report has been received" ];
3083
3083
XCTestExpectation * gotAttributeReportEndExpectation = [testcase expectationWithDescription: @" Attribute report has ended" ];
3084
3084
XCTestExpectation * deviceConfigurationChangedExpectation = [testcase expectationWithDescription: @" Device configuration changed was receieved" ];
3085
+ deviceConfigurationChangedExpectation.inverted = !expectConfigurationChanged;
3085
3086
3086
3087
__block unsigned attributeReportsReceived = 0 ;
3087
3088
__block NSArray <NSDictionary <NSString *, id > *> * testDataValue = nil ;
@@ -3125,19 +3126,15 @@ + (void)checkAttributeReportTriggersConfigurationChanged:(MTRAttributeIDType)att
3125
3126
__block BOOL wasOnDeviceConfigurationChangedCallbackCalled = NO ;
3126
3127
3127
3128
delegate.onDeviceConfigurationChanged = ^() {
3128
- if (expectConfigurationChanged) {
3129
3129
[deviceConfigurationChangedExpectation fulfill ];
3130
- }
3131
3130
wasOnDeviceConfigurationChangedCallbackCalled = YES ;
3132
3131
};
3133
3132
3134
3133
[device unitTestInjectAttributeReport: attributeReport];
3135
3134
3136
- if (expectConfigurationChanged) {
3137
- [testcase waitForExpectations: @[ gotAttributeReportExpectation, gotAttributeReportEndExpectation, deviceConfigurationChangedExpectation ] timeout: kTimeoutInSeconds ];
3138
- XCTAssertTrue (wasOnDeviceConfigurationChangedCallbackCalled);
3139
- } else {
3140
- [testcase waitForExpectations: @[ gotAttributeReportExpectation, gotAttributeReportEndExpectation ] timeout: kTimeoutInSeconds ];
3135
+ [testcase waitForExpectations: @[ gotAttributeReportExpectation, gotAttributeReportEndExpectation, deviceConfigurationChangedExpectation ] timeout: kTimeoutInSeconds ];
3136
+ if (!expectConfigurationChanged)
3137
+ {
3141
3138
XCTAssertFalse (wasOnDeviceConfigurationChangedCallbackCalled);
3142
3139
}
3143
3140
}
0 commit comments