From d796c80420e66a766315b7f3384a027925bb9fe9 Mon Sep 17 00:00:00 2001 From: Ashita Prasad Date: Tue, 11 Apr 2023 23:40:04 +0530 Subject: [PATCH] Create http_utils_test.dart --- test/utils/http_utils_test.dart | 34 +++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 test/utils/http_utils_test.dart diff --git a/test/utils/http_utils_test.dart b/test/utils/http_utils_test.dart new file mode 100644 index 00000000..43023faf --- /dev/null +++ b/test/utils/http_utils_test.dart @@ -0,0 +1,34 @@ +import 'package:test/test.dart'; +import 'package:apidash/utils/http_utils.dart'; + +void main() { + String url1 = ""; + String url1Expected = "untitled"; + String url2 = " "; + String url2Expected = "untitled"; + String url3 = "https://api.foss42.com/country/codes"; + String url3Expected = "api.foss42.com/country/codes"; + String url4 = "api.foss42.com/country/data"; + String url4Expected = "api.foss42.com/country/data"; + String url5 = "http://"; + String url5Expected = "untitled"; + + group("Testing getRequestTitleFromUrl function", () { + test('Testing getRequestTitleFromUrl using url1', () { + expect(getRequestTitleFromUrl(url1), url1Expected); + }); + + test('Testing getRequestTitleFromUrl using url2', () { + expect(getRequestTitleFromUrl(url2), url2Expected); + }); + test('Testing getRequestTitleFromUrl using url3', () { + expect(getRequestTitleFromUrl(url3), url3Expected); + }); + test('Testing getRequestTitleFromUrl using url4', () { + expect(getRequestTitleFromUrl(url4), url4Expected); + }); + test('Testing getRequestTitleFromUrl using url5', () { + expect(getRequestTitleFromUrl(url5), url5Expected); + }); + }); +}