Skip to content
This repository has been archived by the owner on Jul 21, 2023. It is now read-only.

Commit

Permalink
Merge pull request #6 from Floating-Dartists/dev
Browse files Browse the repository at this point in the history
prepare v0.1.0
  • Loading branch information
TesteurManiak committed Feb 25, 2022
2 parents 1a30aa5 + e3955f3 commit 0687fd2
Show file tree
Hide file tree
Showing 11 changed files with 60 additions and 57 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ jobs:
run: dart test --coverage="coverage"
# - name: Exclude generated files from coverage
# run: dart pub run remove_from_coverage -f coverage/lcov.info -r '\.g\.dart$'
# - name: Collect and report coverage
# uses: coverallsapp/github-action@v1.1.2
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Generate Lcov
run: dart pub run coverage:format_coverage --lcov --in=coverage --out=coverage/lcov.info --packages=.packages --report-on=lib
- name: Collect and report coverage
uses: coverallsapp/github-action@v1.1.2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# fl_business_card_core

[![Test workflow](https://github.com/Floating-Dartists/fl_business_card_core/actions/workflows/tests.yml/badge.svg)](https://github.com/Floating-Dartists/fl_business_card_core/actions/workflows/tests.yml)

Open-source & serverless Business Card generator, core in Dart for both Mobile & Web implementations.
2 changes: 1 addition & 1 deletion lib/src/models/global_parser.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:collection/collection.dart';
import 'package:collection/collection.dart' show IterableExtension;
import 'url_parser/url_parser.dart';

class GlobalParser {
Expand Down
4 changes: 3 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
name: fl_business_card_core
description: Open-source & serverless Business Card generator, core in Dart for
both Mobile & Web implementations.
version: 0.0.1
version: 0.1.0
homepage: https://github.com/Floating-Dartists/fl_business_card_core

environment:
sdk: ">=2.16.1 <3.0.0"

dependencies:
collection: ^1.15.0
equatable: ^2.0.3
meta: ^1.7.0

dev_dependencies:
coverage: ^1.1.0
lint: ^1.8.2
mockito: ^5.1.0
remove_from_coverage: ^2.0.0
Expand Down
16 changes: 6 additions & 10 deletions test/parser/custom_parser_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,26 @@ import 'package:test/test.dart';

void main() {
group('CustomParser', () {
const parser = CustomParser();

const tValidUrl = 'https://twitter.com/ABC38_';
const tInvalidUrl = 'htt.fsdfps://twittercom/status/ABC38_';

const tvalidUsername = "twitter.com/ABC38_";

group('isValid', () {
test('A valid URL should return true', () {
expect(const CustomParser().isValid(tValidUrl), true);
expect(parser.isValid(tValidUrl), true);
});

test('An invalid URL should throw a ParseException', () {
expect(
const CustomParser().isValid(tInvalidUrl),
false,
);
expect(parser.isValid(tInvalidUrl), false);
});
});

group('recoverUser', () {
test('A valid custom URL should return the URL, minus the scheme', () {
expect(
const CustomParser().recoverUser(tValidUrl),
tvalidUsername,
);
expect(parser.recoverUser(tValidUrl), tvalidUsername);
});
});

Expand All @@ -36,7 +32,7 @@ void main() {
'A valid custom URL "username" should return the URL, with the sceme',
() {
expect(
const CustomParser().recreateUri(tvalidUsername),
parser.recreateUri(tvalidUsername),
"https://twitter.com/ABC38_",
);
});
Expand Down
10 changes: 6 additions & 4 deletions test/parser/github_parser_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,21 @@ import 'package:test/test.dart';

void main() {
group('GithubParser', () {
const parser = GithubParser();

const tValidUrl = 'https://github.com/ABC38_';
const tInvalidUrl = 'https://githubcom/status/ABC38_';

const tvalidUsername = "ABC38_";

group('isValid', () {
test('A valid URL should return true', () {
expect(const GithubParser().isValid(tValidUrl), true);
expect(parser.isValid(tValidUrl), true);
});

test('An invalid URL should throw a ParseException', () {
expect(
const GithubParser().isValid(tInvalidUrl),
parser.isValid(tInvalidUrl),
false,
);
});
Expand All @@ -25,7 +27,7 @@ void main() {
group('recoverUser', () {
test('A valid Github Url should return the user', () {
expect(
const GithubParser().recoverUser(tValidUrl),
parser.recoverUser(tValidUrl),
tvalidUsername,
);
});
Expand All @@ -34,7 +36,7 @@ void main() {
group('recreateUri', () {
test('A valid Github username should return the tValidUrl', () {
expect(
const GithubParser().recreateUri(tvalidUsername),
parser.recreateUri(tvalidUsername),
tValidUrl,
);
});
Expand Down
23 changes: 7 additions & 16 deletions test/parser/gitlab_parser_test.dart
Original file line number Diff line number Diff line change
@@ -1,44 +1,35 @@
import 'package:fl_business_card_core/fl_business_card_core.dart'
show GitlabParser;
import 'package:fl_business_card_core/src/models/url_parse_exceptions.dart';
import 'package:test/test.dart';

void main() {
group('GitlabParser', () {
const parser = GitlabParser();

const tValidUrl = 'https://gitlab.com/ABC38_';
const tInvalidUrl = 'https://gitlabcom/status/ABC38_';

const tvalidUsername = "ABC38_";

group('isValid', () {
test('A valid URL should return true', () {
expect(const GitlabParser().isValid(tValidUrl), true);
expect(parser.isValid(tValidUrl), true);
});

test('An invalid URL should throw a ParseException', () {
expect(
() => const GitlabParser().isValid(tInvalidUrl),
// const CustomParser().isValid(Uri.parse(tInvalidUrl)),
throwsA(isA<UrlParseException>()),
);
test('An invalid URL should return false', () {
expect(parser.isValid(tInvalidUrl), false);
});
});

group('recoverUser', () {
test('A valid Gitlab Url should return the user', () {
expect(
const GitlabParser().recoverUser(tValidUrl),
tvalidUsername,
);
expect(parser.recoverUser(tValidUrl), tvalidUsername);
});
});

group('recreateUri', () {
test('A valid Gitlab username should return the tValidUrl', () {
expect(
const GitlabParser().recreateUri(tvalidUsername),
tValidUrl,
);
expect(parser.recreateUri(tvalidUsername), tValidUrl);
});
});
});
Expand Down
10 changes: 6 additions & 4 deletions test/parser/linkedin_parser_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,21 @@ import 'package:test/test.dart';

void main() {
group('LinkedInParser', () {
const parser = LinkedInParser();

const tValidUrl = 'https://linkedin.com/in/ABC38_';
const tInvalidUrl = 'https://linkedincom/ABC38_';

const tvalidUsername = "ABC38_";

group('isValid', () {
test('A valid URL should return true', () {
expect(const LinkedInParser().isValid(tValidUrl), true);
expect(parser.isValid(tValidUrl), true);
});

test('An invalid URL should throw a ParseException', () {
expect(
const LinkedInParser().isValid(tInvalidUrl),
parser.isValid(tInvalidUrl),
false,
);
});
Expand All @@ -25,7 +27,7 @@ void main() {
group('recoverUser', () {
test('A valid LinkedIn Url should return the user', () {
expect(
const LinkedInParser().recoverUser(tValidUrl),
parser.recoverUser(tValidUrl),
tvalidUsername,
);
});
Expand All @@ -34,7 +36,7 @@ void main() {
group('recreateUri', () {
test('A valid LinkedIn username should return the tValidUrl', () {
expect(
const LinkedInParser().recreateUri(tvalidUsername),
parser.recreateUri(tvalidUsername),
tValidUrl,
);
});
Expand Down
16 changes: 9 additions & 7 deletions test/parser/medium_parser_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import 'package:test/test.dart';

void main() {
group('MediumParser', () {
const parser = MediumParser();

const tValidUrl = 'https://rouxguillaume.medium.com/';
const tValidUrl2 = 'https://medium.com/@rouxguillaume';
const tInvalidUrl = 'https://rouxguillaume.medium.com/@rouxguillaume/truc';
Expand All @@ -12,16 +14,16 @@ void main() {

group('isValid', () {
test('A valid URL should return true', () {
expect(const MediumParser().isValid(tValidUrl), true);
expect(parser.isValid(tValidUrl), true);
});

test('A valid URL should return true', () {
expect(const MediumParser().isValid(tValidUrl2), true);
expect(parser.isValid(tValidUrl2), true);
});

test('An invalid URL should throw a ParseException', () {
expect(
const MediumParser().isValid(tInvalidUrl),
parser.isValid(tInvalidUrl),
false,
);
});
Expand All @@ -30,14 +32,14 @@ void main() {
group('recoverUser', () {
test('A valid Medium Url should return the user', () {
expect(
const MediumParser().recoverUser(tValidUrl),
parser.recoverUser(tValidUrl),
tvalidUsername,
);
});

test('A valid Medium Url should return the user', () {
expect(
const MediumParser().recoverUser(tValidUrl2),
parser.recoverUser(tValidUrl2),
tvalidUsername2,
);
});
Expand All @@ -46,14 +48,14 @@ void main() {
group('recreateUri', () {
test('A valid Medium username should return the tValidUrl', () {
expect(
const MediumParser().recreateUri(tvalidUsername),
parser.recreateUri(tvalidUsername),
tValidUrl2,
);
});

test('A valid Medium username should return the tValidUrl', () {
expect(
const MediumParser().recreateUri(tvalidUsername2),
parser.recreateUri(tvalidUsername2),
tValidUrl2,
);
});
Expand Down
14 changes: 8 additions & 6 deletions test/parser/stack_overflow_parser_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,28 @@ import 'package:test/test.dart';

void main() {
group('StackOverflowParser', () {
const parser = StackOverflowParser();

const tValidUrl = 'https://stackoverflow.com/users/13923049/me%c3%af-m';
const tValidUrl2 = 'https://stackoverflow.com/users/13923049';
const tInvalidUrl = 'https://stackoverflow.com/13923049';
const tvalidUsername = "13923049";

group('isValid', () {
test('A valid URL should return true', () {
expect(const StackOverflowParser().isValid(tValidUrl), true);
expect(parser.isValid(tValidUrl), true);
});

test('A valid URL should return true', () {
expect(
const StackOverflowParser().isValid(tValidUrl2),
parser.isValid(tValidUrl2),
true,
);
});

test('An invalid URL should throw a ParseException', () {
expect(
const StackOverflowParser().isValid(tInvalidUrl),
parser.isValid(tInvalidUrl),
false,
);
});
Expand All @@ -32,14 +34,14 @@ void main() {
group('recoverUser', () {
test('A valid StackOverflow Url should return the user', () {
expect(
const StackOverflowParser().recoverUser(tValidUrl),
parser.recoverUser(tValidUrl),
tvalidUsername,
);
});

test('A valid StackOverflow Url should return the user', () {
expect(
const StackOverflowParser().recoverUser(tValidUrl2),
parser.recoverUser(tValidUrl2),
tvalidUsername,
);
});
Expand All @@ -48,7 +50,7 @@ void main() {
group('recreateUri', () {
test('A valid StackOverflow username should return the tValidUrl', () {
expect(
const StackOverflowParser().recreateUri(tvalidUsername),
parser.recreateUri(tvalidUsername),
tValidUrl2,
);
});
Expand Down
10 changes: 6 additions & 4 deletions test/parser/twitter_parser_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,21 @@ import 'package:test/test.dart';

void main() {
group('TwitterParser', () {
const parser = TwitterParser();

const tValidUrl = 'https://twitter.com/ABC38_';
const tInvalidUrl = 'https://twittercom/status/ABC38_';

const tvalidUsername = "ABC38_";

group('isValid', () {
test('A valid URL should return true', () {
expect(const TwitterParser().isValid(tValidUrl), true);
expect(parser.isValid(tValidUrl), true);
});

test('An invalid URL should throw a ParseException', () {
expect(
const TwitterParser().isValid(tInvalidUrl),
parser.isValid(tInvalidUrl),
false,
);
});
Expand All @@ -25,7 +27,7 @@ void main() {
group('recoverUser', () {
test('A valid Twitter Url should return the user', () {
expect(
const TwitterParser().recoverUser(tValidUrl),
parser.recoverUser(tValidUrl),
tvalidUsername,
);
});
Expand All @@ -34,7 +36,7 @@ void main() {
group('recreateUri', () {
test('A valid Twitter username should return the tValidUrl', () {
expect(
const TwitterParser().recreateUri(tvalidUsername),
parser.recreateUri(tvalidUsername),
tValidUrl,
);
});
Expand Down

0 comments on commit 0687fd2

Please sign in to comment.