Added a new field called push provider name in addDevice api call

This commit is contained in:
Ayush Shekhar
2022-04-27 18:23:17 +05:30
parent d58f727a57
commit 28649107ee
5 changed files with 83 additions and 6 deletions
@@ -20,7 +20,7 @@ void main() {
deviceApi = DeviceApi(client);
});
test('addDevice', () async {
test('addDevice should work', () async {
const deviceId = 'test-device-id';
const pushProvider = PushProvider.firebase;
@@ -44,6 +44,36 @@ void main() {
verifyNoMoreInteractions(client);
});
test('addDevice should work with pushProviderName', () async {
const deviceId = 'test-device-id';
const pushProvider = PushProvider.firebase;
const pushProviderName = 'my-custom-config';
const path = '/devices';
when(() => client.post(
path,
data: {
'id': deviceId,
'push_provider': pushProvider.name,
'push_provider_name': pushProviderName,
},
))
.thenAnswer(
(_) async => successResponse(path, data: <String, dynamic>{}));
final res = await deviceApi.addDevice(
deviceId,
pushProvider,
pushProviderName: pushProviderName,
);
expect(res, isNotNull);
verify(() => client.post(path, data: any(named: 'data'))).called(1);
verifyNoMoreInteractions(client);
});
test('getDevices', () async {
const path = '/devices';