-
-
Notifications
You must be signed in to change notification settings - Fork 12
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
1 parent
2e604f2
commit 493b886
Showing
4 changed files
with
71 additions
and
30 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:odin/services/random_service.dart'; | ||
|
||
void main() { | ||
group("Random -", () { | ||
test("Result should be String", () { | ||
final RandomService _randomService = RandomService(); | ||
final String randomText = _randomService.getRandomString(10); | ||
expect(randomText, isA<String>()); | ||
}); | ||
test("Result should be 10 char long", () { | ||
final RandomService _randomService = RandomService(); | ||
final String randomText = _randomService.getRandomString(10); | ||
expect(randomText, hasLength(10)); | ||
}); | ||
}); | ||
} |
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,13 @@ | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:odin/services/shortener_service.dart'; | ||
|
||
void main() { | ||
group("Shortener -", () { | ||
test("Url should contain shrtco.de", () async { | ||
final ShortenerService _shortnerService = ShortenerService(); | ||
const String url = "https://www.google.com"; | ||
final String? shortUrl = await _shortnerService.getShortUrl(url: url); | ||
expect(shortUrl, stringContainsInOrder(["https://", "shrtco.de"])); | ||
}); | ||
}); | ||
} |
This file was deleted.
Oops, something went wrong.
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,41 @@ | ||
import 'dart:io'; | ||
|
||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:odin/services/locator.dart'; | ||
import 'package:odin/services/zip_service.dart'; | ||
import 'package:path/path.dart'; | ||
import 'package:path_provider/path_provider.dart'; | ||
|
||
void main() { | ||
setUpAll(() => setupLocator()); | ||
group("Zip -", () { | ||
test("Result should be a File", () async { | ||
final ZipService _zipService = ZipService(); | ||
final directory = await getTemporaryDirectory(); | ||
final file = File('${directory.path}\\hello.txt'); | ||
file.writeAsStringSync('Hello World!'); | ||
final File zippedFile = await _zipService.zipFile(fileToZips: [file]); | ||
expect(zippedFile, isA<File>()); | ||
}); | ||
test("Result should be of zip extension", () async { | ||
final ZipService _zipService = ZipService(); | ||
final directory = await getTemporaryDirectory(); | ||
final file = File('${directory.path}\\hello2.txt'); | ||
file.writeAsStringSync('Hello World!'); | ||
final File zippedFile = await _zipService.zipFile(fileToZips: [file]); | ||
expect(basename(zippedFile.path), stringContainsInOrder([".zip"])); | ||
}); | ||
test("Result should contain first file name", () async { | ||
final ZipService _zipService = ZipService(); | ||
final directory = await getTemporaryDirectory(); | ||
final file = File('${directory.path}\\hello3.txt'); | ||
file.writeAsStringSync('Hello World!'); | ||
final file2 = File('${directory.path}\\hello4.txt'); | ||
file2.writeAsStringSync('Hello World!'); | ||
final File zippedFile = | ||
await _zipService.zipFile(fileToZips: [file, file2]); | ||
expect(basename(zippedFile.path), | ||
stringContainsInOrder(["hello3", "txt", ".zip"])); | ||
}); | ||
}); | ||
} |