Fakultas Ilmu Komputer UI
Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ppl-fasilkom-ui
PPL Sosial
bisago
bisago-fe
Commits
528e06c9
Commit
528e06c9
authored
May 22, 2021
by
Yoga Pratama
Browse files
[RED] Implement test for fcm repository
parent
ce7dbd1b
Pipeline
#78257
passed with stages
in 12 minutes and 51 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
lib/repository/cloud_messaging_repository.dart
0 → 100644
View file @
528e06c9
abstract
class
BaseCloudMessagingRepository
{
Future
<
void
>
sendFCMToken
(
String
fcmToken
,
String
token
);
}
class
CloudMessagingRepository
implements
BaseCloudMessagingRepository
{
@override
Future
<
bool
>
sendFCMToken
(
String
fcmToken
,
String
token
)
async
{
return
false
;
}
}
test/cloud_messaging_test.dart
0 → 100644
View file @
528e06c9
import
'package:bisaGo/repository/cloud_messaging_repository.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:get_it/get_it.dart'
;
import
'package:mockito/mockito.dart'
;
class
MockCloudMessagingRepository
extends
Fake
implements
CloudMessagingRepository
{
@override
Future
<
bool
>
sendFCMToken
(
String
fcmToken
,
String
token
)
async
{
return
Future
.
value
(
true
);
}
}
void
main
(
)
{
setUpAll
(()
{
final
_getIt
=
GetIt
.
instance
;
_getIt
.
registerLazySingleton
<
BaseCloudMessagingRepository
>(
()
=>
MockCloudMessagingRepository
());
});
testWidgets
(
'Generate fcm token'
,
(
WidgetTester
tester
)
async
{
final
generatedUrl
=
await
MockCloudMessagingRepository
().
sendFCMToken
(
'fcmToken'
,
'token'
);
expect
(
generatedUrl
,
true
);
});
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment