-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix capitalization style for UUID and constant names (#437) * Fix capitalization of UUID in Service * Fix capitalization of UUID in ScanResult * Fix capitalization of UUID in Peripheral * Rename bytes to value * Fix capitalization of UUID in metadata strings in ScanResult * Fix constants capitalization in BleError * Revert "Fix capitalization of UUID in metadata strings in ScanResult" This reverts commit 08516ec. * Fix capitalization of UUID in managers for classes * Fix capitalization of UUID for InternalBleManager * Fix capitalization of UUID in CharacteristicsMixin * Fix capitalization of UUID in DevicesMixin * Rename bytes to value in internal classes * Add unit tests for Service (#439) * unit test for BleManager * [descriptor] override equals & hashcode functions * [tests] add: mock classes for managers * [service] add: service tests * [tests] create characteristics and descriptors using separate generators * [service][tests] cover generating transactionId when it's not specified * [service][tests] clear mocks interactions after each test * [service][tests] add missing test for getting all descriptors for specified characteristic Co-authored-by: Paweł Byszewski <[email protected]> * Descriptor unit tests (#441) * unit test for BleManager * [descriptor] override equals & hashcode functions * [tests] add: mock classes for managers * [tests] create characteristics and descriptors using separate generators * [descriptor] add: tests * [descriptor] fix: test names * [tests] move all mocks declarations to one aggregate file * [ble-manager][test] add matcher to always check objects' references * [descriptor][test] add tests that check uniquity of transactionId Co-authored-by: pawelByszewski <[email protected]> * [iOS] Fixed casting of Bool arguments received from dart (#451) * Remove root level `Flutter User Facing API.dart` (#455) * rename root level file naming interfered with certain build_runner code generators * remove flutter_user_facing_api.dart * Release 2.2.4 Co-authored-by: Łukasz Rejman <[email protected]> Co-authored-by: Bartosz Wilk <[email protected]> Co-authored-by: Paweł Byszewski <[email protected]> Co-authored-by: pawelByszewski <[email protected]> Co-authored-by: Tomasz Bogusz <[email protected]> Co-authored-by: Dustin Graham <[email protected]>
- Loading branch information
1 parent
47d12e1
commit 7d55135
Showing
12 changed files
with
141 additions
and
116 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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
group 'com.polidea.flutter_ble_lib' | ||
version '2.2.3' | ||
version '2.2.4' | ||
|
||
buildscript { | ||
repositories { | ||
|
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
name: flutter_ble_lib | ||
description: FlutterBle Library is a flutter library that supports BLE operations. It uses MultiPlatformBleAdapter as a native backend.. | ||
version: 2.2.3 | ||
version: 2.2.4 | ||
author: "Polidea <[email protected]>" | ||
homepage: https://github.com/Polidea/FlutterBleLib | ||
|
||
|
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,118 @@ | ||
import 'dart:async'; | ||
import 'dart:typed_data'; | ||
|
||
import 'package:flutter_ble_lib/flutter_ble_lib.dart'; | ||
import 'package:flutter_ble_lib/src/_managers_for_classes.dart'; | ||
import 'package:mockito/mockito.dart'; | ||
import 'package:test/test.dart'; | ||
|
||
import 'mock/mocks.dart'; | ||
import 'test_util/descriptor_generator.dart'; | ||
|
||
void main() { | ||
ManagerForDescriptor managerForDescriptor = ManagerForDescriptorMock(); | ||
DescriptorGenerator descriptorGenerator = | ||
DescriptorGenerator(managerForDescriptor); | ||
|
||
DescriptorWithValue createDescriptor(int seed) => | ||
descriptorGenerator.create(seed, CharacteristicMock()); | ||
|
||
Descriptor descriptor = createDescriptor(123); | ||
|
||
tearDown(() { | ||
clearInteractions(managerForDescriptor); | ||
}); | ||
|
||
test("read returns expected value", () async { | ||
//given | ||
when(managerForDescriptor.readDescriptorForIdentifier(descriptor, "456")) | ||
.thenAnswer((_) => Future.value(Uint8List.fromList([1, 2, 3, 4]))); | ||
|
||
//when | ||
var value = await descriptor.read(transactionId: "456"); | ||
|
||
//then | ||
expect(value, equals(Uint8List.fromList([1, 2, 3, 4]))); | ||
}); | ||
|
||
test( | ||
"read invokes manager with expected params when transactionId is specified", | ||
() { | ||
//when | ||
descriptor.read(transactionId: "456"); | ||
|
||
//then | ||
verify( | ||
managerForDescriptor.readDescriptorForIdentifier(descriptor, "456"), | ||
); | ||
}); | ||
|
||
test( | ||
"read invokes manager with expected params when transactionId is not specified", | ||
() { | ||
//when | ||
descriptor.read(); | ||
|
||
//then | ||
verify( | ||
managerForDescriptor.readDescriptorForIdentifier( | ||
descriptor, argThat(isNotNull)), | ||
); | ||
}); | ||
|
||
test( | ||
"read invokes manager with unique transactionId when transactionId is not specified", | ||
() { | ||
//when | ||
descriptor.read(); | ||
descriptor.read(); | ||
|
||
//then | ||
var transactionIds = verify( | ||
managerForDescriptor.readDescriptorForIdentifier( | ||
descriptor, captureThat(isNotNull)), | ||
).captured; | ||
expect(transactionIds[0], isNot(equals(transactionIds[1]))); | ||
}); | ||
|
||
test( | ||
"write invokes manager with expected params when transactionId is specified", | ||
() { | ||
//when | ||
descriptor.write(Uint8List.fromList([1, 2, 3, 4]), transactionId: "456"); | ||
|
||
//then | ||
verify( | ||
managerForDescriptor.writeDescriptorForIdentifier( | ||
descriptor, Uint8List.fromList([1, 2, 3, 4]), "456"), | ||
); | ||
}); | ||
|
||
test( | ||
"write invokes manager with expected params when transactionId is not specified", | ||
() { | ||
//when | ||
descriptor.write(Uint8List.fromList([1, 2, 3, 4])); | ||
|
||
//then | ||
verify( | ||
managerForDescriptor.writeDescriptorForIdentifier( | ||
descriptor, Uint8List.fromList([1, 2, 3, 4]), argThat(isNotNull)), | ||
); | ||
}); | ||
|
||
test( | ||
"write invokes manager with unique transactionId when transactionId is not specified", | ||
() { | ||
//when | ||
descriptor.write(Uint8List.fromList([1, 2, 3, 4])); | ||
descriptor.write(Uint8List.fromList([1, 2, 3, 4])); | ||
|
||
//then | ||
var transactionIds = verify( | ||
managerForDescriptor.writeDescriptorForIdentifier(descriptor, | ||
Uint8List.fromList([1, 2, 3, 4]), captureThat(isNotNull))) | ||
.captured; | ||
expect(transactionIds[0], isNot(equals(transactionIds[1]))); | ||
}); | ||
} |
This file was deleted.
Oops, something went wrong.
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