This repository has been archived by the owner on Oct 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
nathanvandeperre97
authored
Sep 15, 2020
1 parent
544558c
commit b4b6e4a
Showing
8 changed files
with
168 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import 'package:MobileOne/services/share_service.dart'; | ||
import 'package:contacts_service/contacts_service.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
|
||
void main() { | ||
test("Filter contacts", () { | ||
//Given | ||
|
||
final service = ShareService(); | ||
List<Contact> list = [ | ||
Contact(displayName: "test", emails: {Item(value: "test@test.test")}), | ||
Contact(displayName: "second test"), | ||
Contact(), | ||
Contact(emails: {Item(value: "test@test.test")}), | ||
]; | ||
|
||
//When | ||
List<Contact> result = service.filterContacts(list, "second"); | ||
|
||
//Then | ||
expect(result == null, false); | ||
expect(result.isNotEmpty, true); | ||
expect( | ||
result.singleWhere((element) => element.displayName == "second test") != | ||
null, | ||
true); | ||
expect(result.length, 1); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import 'package:MobileOne/localization/supported.dart'; | ||
import 'package:MobileOne/widgets/widget_share_contact.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
|
||
void main() { | ||
setSupportedLocales([Locale('fr', 'FR')]); | ||
|
||
group('Share contact tests', () { | ||
test('Share contact widget should work with a name', () { | ||
//GIVEN | ||
|
||
//WHEN | ||
WidgetShareContact _widget = WidgetShareContact( | ||
name: "test", | ||
); | ||
|
||
//THEN | ||
expect(_widget != null, true); | ||
expect(_widget.name, "test"); | ||
}); | ||
|
||
test('Share contact widget should work with an email', () { | ||
//GIVEN | ||
|
||
//WHEN | ||
WidgetShareContact _widget = WidgetShareContact( | ||
email: "test@test.test", | ||
); | ||
|
||
//THEN | ||
expect(_widget != null, true); | ||
expect(_widget.email, "test@test.test"); | ||
}); | ||
|
||
test('Share contact widget should work with an email and a name', () { | ||
//GIVEN | ||
|
||
//WHEN | ||
WidgetShareContact _widget = WidgetShareContact( | ||
email: "test@test.test", | ||
name: "test", | ||
); | ||
|
||
//THEN | ||
expect(_widget != null, true); | ||
expect(_widget.email, "test@test.test"); | ||
expect(_widget.name, "test"); | ||
}); | ||
|
||
test('Share contact widget should work without an email and a name', () { | ||
//GIVEN | ||
|
||
//WHEN | ||
WidgetShareContact _widget = WidgetShareContact(); | ||
|
||
//THEN | ||
expect(_widget != null, true); | ||
}); | ||
}); | ||
} |