mirror of
https://github.com/foss42/apidash.git
synced 2025-12-05 04:18:56 +08:00
Added Tests for (/lib/utils): 100% Coverage
This commit is contained in:
@@ -176,4 +176,33 @@ void main() {
|
||||
expect(getValidRequestUri(url7, null), (uri7Expected, null));
|
||||
});
|
||||
});
|
||||
|
||||
group("Testing stripUriParams", () {
|
||||
test('Removes query parameters from Uri with query', () {
|
||||
final uri = Uri.parse(
|
||||
"https://example.com/path/to/resource?param1=value1¶m2=value2",
|
||||
);
|
||||
expect(stripUriParams(uri), "https://example.com/path/to/resource");
|
||||
});
|
||||
|
||||
test('Removes fragment and query from Uri', () {
|
||||
final uri = Uri.parse("https://example.com/api#section?foo=bar");
|
||||
expect(stripUriParams(uri), "https://example.com/api");
|
||||
});
|
||||
|
||||
test('stripUrlParams removes query from URL string', () {
|
||||
const url = "https://example.com/page?x=1&y=2";
|
||||
expect(stripUrlParams(url), "https://example.com/page");
|
||||
});
|
||||
|
||||
test('stripUrlParams handles URL with no query', () {
|
||||
const url = "https://example.com/page";
|
||||
expect(stripUrlParams(url), "https://example.com/page");
|
||||
});
|
||||
|
||||
test('stripUrlParams with only ? and no query', () {
|
||||
const url = "https://example.com/page?";
|
||||
expect(stripUrlParams(url), "https://example.com/page");
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user