chore: addressed review feedback

pull/225/head
Jonathan Daniels 3 years ago committed by jonathandaniels-vgv
parent b97dff454c
commit f0c7545422

@ -11,7 +11,9 @@ class ShareRepository {
static const _shareUrl = 'https://ashehwkdkdjruejdnensjsjdne.web.app/#/'; static const _shareUrl = 'https://ashehwkdkdjruejdnensjsjdne.web.app/#/';
/// Returns a url to share the [shareText] on the given [platform]. /// Returns a url to share the [shareText] on the given [platform].
///
/// The returned url can be opened using the [url_launcher](https://pub.dev/packages/url_launcher) package. /// The returned url can be opened using the [url_launcher](https://pub.dev/packages/url_launcher) package.
///
/// The [shareText] must have the score embedded. /// The [shareText] must have the score embedded.
String shareScore({ String shareScore({
required String shareText, required String shareText,

@ -10,36 +10,30 @@ void main() {
shareRepository = ShareRepository(); shareRepository = ShareRepository();
}); });
group('constructor', () { test('can be instantiated', () {
test('creates new ShareRepository instance', () { expect(ShareRepository(), isNotNull);
expect(ShareRepository(), isNotNull);
});
}); });
group('shareScore', () { group('shareScore', () {
const shareText = 'hello world!'; const shareText = 'hello world!';
test('returns the correct share url for twitter', () async { test('returns the correct share url for twitter', () async {
expect( const shareScoreUrl =
shareRepository.shareScore( 'https://twitter.com/intent/tweet?url=https%3A%2F%2Fashehwkdkdjruejdnensjsjdne.web.app%2F%23%2F&text=hello%20world!';
shareText: shareText, final shareScoreResult = shareRepository.shareScore(
platform: SharePlatform.twitter, shareText: shareText,
), platform: SharePlatform.twitter,
equals(
'https://twitter.com/intent/tweet?url=https%3A%2F%2Fashehwkdkdjruejdnensjsjdne.web.app%2F%23%2F&text=hello%20world!',
),
); );
expect(shareScoreResult, equals(shareScoreUrl));
}); });
test('returns the correct share url for facebook', () async { test('returns the correct share url for facebook', () async {
expect( const shareScoreUrl =
shareRepository.shareScore( 'https://www.facebook.com/sharer.php?u=https%3A%2F%2Fashehwkdkdjruejdnensjsjdne.web.app%2F%23%2F&quote=hello%20world!';
shareText: shareText, final shareScoreResult = shareRepository.shareScore(
platform: SharePlatform.facebook, shareText: shareText,
), platform: SharePlatform.facebook,
equals(
'https://www.facebook.com/sharer.php?u=https%3A%2F%2Fashehwkdkdjruejdnensjsjdne.web.app%2F%23%2F&quote=hello%20world!',
),
); );
expect(shareScoreResult, equals(shareScoreUrl));
}); });
}); });
}); });

Loading…
Cancel
Save