From f0c7545422284d714dfdf0aed74a3784b5d49f4a Mon Sep 17 00:00:00 2001 From: Jonathan Daniels Date: Fri, 22 Apr 2022 13:00:00 -0700 Subject: [PATCH] chore: addressed review feedback --- .../lib/src/share_repository.dart | 2 ++ .../test/src/share_repository_test.dart | 34 ++++++++----------- 2 files changed, 16 insertions(+), 20 deletions(-) diff --git a/packages/share_repository/lib/src/share_repository.dart b/packages/share_repository/lib/src/share_repository.dart index c39ca477..fe2eab92 100644 --- a/packages/share_repository/lib/src/share_repository.dart +++ b/packages/share_repository/lib/src/share_repository.dart @@ -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, diff --git a/packages/share_repository/test/src/share_repository_test.dart b/packages/share_repository/test/src/share_repository_test.dart index 3bba84fd..e26d0000 100644 --- a/packages/share_repository/test/src/share_repository_test.dart +++ b/packages/share_repository/test/src/share_repository_test.dart @@ -10,36 +10,30 @@ void main() { shareRepository = ShareRepository(); }); - group('constructor', () { - test('creates new ShareRepository instance', () { - expect(ShareRepository(), isNotNull); - }); + 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( - shareText: shareText, - platform: SharePlatform.twitter, - ), - equals( - 'https://twitter.com/intent/tweet?url=https%3A%2F%2Fashehwkdkdjruejdnensjsjdne.web.app%2F%23%2F&text=hello%20world!', - ), + 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, ); + expect(shareScoreResult, equals(shareScoreUrl)); }); test('returns the correct share url for facebook', () async { - expect( - shareRepository.shareScore( - shareText: shareText, - platform: SharePlatform.facebook, - ), - equals( - 'https://www.facebook.com/sharer.php?u=https%3A%2F%2Fashehwkdkdjruejdnensjsjdne.web.app%2F%23%2F"e=hello%20world!', - ), + const shareScoreUrl = + 'https://www.facebook.com/sharer.php?u=https%3A%2F%2Fashehwkdkdjruejdnensjsjdne.web.app%2F%23%2F"e=hello%20world!'; + final shareScoreResult = shareRepository.shareScore( + shareText: shareText, + platform: SharePlatform.facebook, ); + expect(shareScoreResult, equals(shareScoreUrl)); }); }); });