Merge branch 'develop' into chore/update_dart_vlc

This commit is contained in:
Rafal Adasiewicz
2022-12-21 08:52:27 +01:00
committed by GitHub
3 changed files with 36 additions and 14 deletions
+5
View File
@@ -1,6 +1,11 @@
## Upcomming ## Upcomming
✅ Added
- Added `Huawei` and `Xiaomi` PushProviders.
🐞 Fixed 🐞 Fixed
- Fixed initializing last synced date. - Fixed initializing last synced date.
## 5.1.0 ## 5.1.0
@@ -6,6 +6,12 @@ enum PushProvider {
/// Send notifications using Google's Firebase Cloud Messaging /// Send notifications using Google's Firebase Cloud Messaging
firebase, firebase,
/// Send notifications using Huawei's Push Kit
huawei,
/// Send notifications using Xiaomi's Mi Push Service
xiaomi,
/// Send notifications using Apple's Push Notification service /// Send notifications using Apple's Push Notification service
apn, apn,
} }
@@ -22,26 +22,37 @@ void main() {
test('addDevice should work', () async { test('addDevice should work', () async {
const deviceId = 'test-device-id'; const deviceId = 'test-device-id';
const pushProvider = PushProvider.firebase; const pushProvidersMap = {
'apn': PushProvider.apn,
'firebase': PushProvider.firebase,
'huawei': PushProvider.huawei,
'xiaomi': PushProvider.xiaomi,
};
const path = '/devices'; const path = '/devices';
when(() => client.post( for (final pushProviderMapEntry in pushProvidersMap.entries) {
path, final data = {
data: { 'id': deviceId,
'id': deviceId, 'push_provider': pushProviderMapEntry.key,
'push_provider': pushProvider.name, };
}, when(() {
)) return client.post(
.thenAnswer( path,
(_) async => successResponse(path, data: <String, dynamic>{})); data: data,
);
}).thenAnswer(
(_) async => successResponse(path, data: <String, dynamic>{}));
final res = await deviceApi.addDevice(deviceId, pushProvider); final res =
await deviceApi.addDevice(deviceId, pushProviderMapEntry.value);
expect(res, isNotNull); expect(res, isNotNull);
verify(() => client.post(path, data: any(named: 'data'))).called(1); verify(() => client.post(path, data: data)).called(1);
}
verifyNoMoreInteractions(client); verifyNoMoreInteractions(client);
expect(pushProvidersMap.length, PushProvider.values.length,
reason: 'All PushProvider should be tested');
}); });
test('addDevice should work with pushProviderName', () async { test('addDevice should work with pushProviderName', () async {