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/#/';
/// 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 [shareText] must have the score embedded.
String shareScore({
required String shareText,

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