chore: rename method signature

pull/225/head
Jonathan Daniels 3 years ago committed by jonathandaniels-vgv
parent dfac24398a
commit 84c3dda060

@ -11,17 +11,17 @@ class ShareRepository {
final String _appUrl;
/// Returns a url to share the [shareText] on the given [platform].
/// Returns a url to share the [value] on the given [platform].
///
/// The returned url can be opened using the [url_launcher](https://pub.dev/packages/url_launcher) package.
///
/// The [shareText] must have the score embedded.
String shareScore({
required String shareText,
/// The [value] must have the score embedded.
String shareText({
required String value,
required SharePlatform platform,
}) {
final encodedUrl = Uri.encodeComponent(_appUrl);
final encodedShareText = Uri.encodeComponent(shareText);
final encodedShareText = Uri.encodeComponent(value);
switch (platform) {
case SharePlatform.twitter:
return 'https://twitter.com/intent/tweet?url=$encodedUrl&text=$encodedShareText';

@ -15,13 +15,13 @@ void main() {
expect(ShareRepository(appUrl: appUrl), isNotNull);
});
group('shareScore', () {
group('shareText', () {
const shareText = 'hello world!';
test('returns the correct share url for twitter', () async {
const shareScoreUrl =
'https://twitter.com/intent/tweet?url=https%3A%2F%2Ffakeurl.com%2F&text=hello%20world!';
final shareScoreResult = shareRepository.shareScore(
shareText: shareText,
final shareScoreResult = shareRepository.shareText(
value: shareText,
platform: SharePlatform.twitter,
);
expect(shareScoreResult, equals(shareScoreUrl));
@ -30,8 +30,8 @@ void main() {
test('returns the correct share url for facebook', () async {
const shareScoreUrl =
'https://www.facebook.com/sharer.php?u=https%3A%2F%2Ffakeurl.com%2F&quote=hello%20world!';
final shareScoreResult = shareRepository.shareScore(
shareText: shareText,
final shareScoreResult = shareRepository.shareText(
value: shareText,
platform: SharePlatform.facebook,
);
expect(shareScoreResult, equals(shareScoreUrl));

Loading…
Cancel
Save