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

Commit

Permalink
Merge branch 'feature/super_unit_tests' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
MeixDev committed Feb 25, 2022
2 parents 7796f8d + 6106327 commit 13f97fa
Show file tree
Hide file tree
Showing 7 changed files with 144 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/parser/custom_parser_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,27 @@ void main() {

const tvalidUsername = "twitter.com/ABC38_";

group('super constructor', () {
test('should return a valid instance', () {
expect(parser, isNotNull);
});

test('should return a valid instance', () {
expect(parser, isA<CustomParser>());
});

test('should contain the right parameters', () {
expect(parser.service, "Custom");
expect(
parser.hosts,
const ["*"],
);
expect(parser.schemes, const ["https", "http", ""]);
expect(parser.pathSegments, const []);
expect(parser.queryParameters, const {});
});
});

group('isValid', () {
test('A valid URL should return true', () {
expect(parser.isValid(tValidUrl), true);
Expand Down
21 changes: 21 additions & 0 deletions test/parser/github_parser_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,27 @@ void main() {

const tvalidUsername = "ABC38_";

group('super constructor', () {
test('should return a valid instance', () {
expect(parser, isNotNull);
});

test('should return a valid instance', () {
expect(parser, isA<GithubParser>());
});

test('should contain the right parameters', () {
expect(parser.service, "GitHub");
expect(
parser.hosts,
const ["github.com", "www.github.com"],
);
expect(parser.schemes, const ["https", "http", ""]);
expect(parser.pathSegments, const ["{user}"]);
expect(parser.queryParameters, const {});
});
});

group('isValid', () {
test('A valid URL should return true', () {
expect(parser.isValid(tValidUrl), true);
Expand Down
21 changes: 21 additions & 0 deletions test/parser/gitlab_parser_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,27 @@ void main() {

const tvalidUsername = "ABC38_";

group('super constructor', () {
test('should return a valid instance', () {
expect(parser, isNotNull);
});

test('should return a valid instance', () {
expect(parser, isA<GitlabParser>());
});

test('should contain the right parameters', () {
expect(parser.service, "GitLab");
expect(
parser.hosts,
const ["gitlab.com", "www.gitlab.com"],
);
expect(parser.schemes, const ["https", "http", ""]);
expect(parser.pathSegments, const ["{user}"]);
expect(parser.queryParameters, const {});
});
});

group('isValid', () {
test('A valid URL should return true', () {
expect(parser.isValid(tValidUrl), true);
Expand Down
21 changes: 21 additions & 0 deletions test/parser/linkedin_parser_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,27 @@ void main() {

const tvalidUsername = "ABC38_";

group('super constructor', () {
test('should return a valid instance', () {
expect(parser, isNotNull);
});

test('should return a valid instance', () {
expect(parser, isA<LinkedInParser>());
});

test('should contain the right parameters', () {
expect(parser.service, "LinkedIn");
expect(
parser.hosts,
const ["linkedin.com", "www.linkedin.com"],
);
expect(parser.schemes, const ["https", "http", ""]);
expect(parser.pathSegments, const ["in", "{user}"]);
expect(parser.queryParameters, const {});
});
});

group('isValid', () {
test('A valid URL should return true', () {
expect(parser.isValid(tValidUrl), true);
Expand Down
21 changes: 21 additions & 0 deletions test/parser/medium_parser_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,27 @@ void main() {
const tvalidUsername = "rouxguillaume";
const tvalidUsername2 = "@rouxguillaume";

group('super constructor', () {
test('should return a valid instance', () {
expect(parser, isNotNull);
});

test('should return a valid instance', () {
expect(parser, isA<MediumParser>());
});

test('should contain the right parameters', () {
expect(parser.service, "Medium");
expect(
parser.hosts,
const ["medium.com", "{user}.medium.com", "www.medium.com"],
);
expect(parser.schemes, const ["https", "http", ""]);
expect(parser.pathSegments, const ["{user}"]);
expect(parser.queryParameters, const {});
});
});

group('isValid', () {
test('A valid URL should return true', () {
expect(parser.isValid(tValidUrl), true);
Expand Down
21 changes: 21 additions & 0 deletions test/parser/stack_overflow_parser_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,27 @@ void main() {
const tInvalidUrl = 'https://stackoverflow.com/13923049';
const tvalidUsername = "13923049";

group('super constructor', () {
test('should return a valid instance', () {
expect(parser, isNotNull);
});

test('should return a valid instance', () {
expect(parser, isA<StackOverflowParser>());
});

test('should contain the right parameters', () {
expect(parser.service, 'Stack Overflow');
expect(
parser.hosts,
const ["stackoverflow.com", "www.stackoverflow.com"],
);
expect(parser.schemes, const ["https", "http", ""]);
expect(parser.pathSegments, const ["users", "{user}"]);
expect(parser.queryParameters, const {});
});
});

group('isValid', () {
test('A valid URL should return true', () {
expect(parser.isValid(tValidUrl), true);
Expand Down
18 changes: 18 additions & 0 deletions test/parser/twitter_parser_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,24 @@ void main() {

const tvalidUsername = "ABC38_";

group('super constructor', () {
test('should return a valid instance', () {
expect(parser, isNotNull);
});

test('should return a valid instance', () {
expect(parser, isA<TwitterParser>());
});

test('should contain the right parameters', () {
expect(parser.service, 'Twitter');
expect(parser.hosts, const ["twitter.com", "www.twitter.com"]);
expect(parser.schemes, const ["https", "http", ""]);
expect(parser.pathSegments, const ["{user}"]);
expect(parser.queryParameters, const {});
});
});

group('isValid', () {
test('A valid URL should return true', () {
expect(parser.isValid(tValidUrl), true);
Expand Down

0 comments on commit 13f97fa

Please sign in to comment.