Add more test for saveBaseUrl and toQualifiedUrl
This commit is contained in:
committed by
Dat H. Pham
parent
b073cd9aa8
commit
791edb41c2
@@ -7,8 +7,8 @@ void main() {
|
||||
group('method convertToQualifiedUrl test', () {
|
||||
|
||||
test('convertToQualifiedUrl() should return qualified url when baseUrl is `https://domain.com` and sourceUrl is `https://domain.com/jmap`', () async {
|
||||
final baseUrl = Uri.parse('https://domain.com');
|
||||
final sourceUrl = Uri.parse('https://domain.com/jmap');
|
||||
final baseUrl = Uri.parse('https://domain.com');
|
||||
final sourceUrl = Uri.parse('https://domain.com/jmap');
|
||||
|
||||
final qualifiedUrlExpected = Uri.parse('https://domain.com/jmap');
|
||||
final qualifiedUrlResult = sourceUrl.toQualifiedUrl(baseUrl: baseUrl);
|
||||
@@ -17,8 +17,8 @@ void main() {
|
||||
});
|
||||
|
||||
test('convertToQualifiedUrl() should return qualified url when baseUrl is `https://domain.com` and sourceUrl is `/jmap/`', () async {
|
||||
final baseUrl = Uri.parse('https://domain.com');
|
||||
final sourceUrl = Uri.parse('/jmap/');
|
||||
final baseUrl = Uri.parse('https://domain.com');
|
||||
final sourceUrl = Uri.parse('/jmap/');
|
||||
|
||||
final qualifiedUrlExpected = Uri.parse('https://domain.com/jmap');
|
||||
final qualifiedUrlResult = sourceUrl.toQualifiedUrl(baseUrl: baseUrl);
|
||||
@@ -27,8 +27,8 @@ void main() {
|
||||
});
|
||||
|
||||
test('convertToQualifiedUrl() should return qualified url when baseUrl is `https://domain.com` and sourceUrl is `/jmap`', () async {
|
||||
final baseUrl = Uri.parse('https://domain.com');
|
||||
final sourceUrl = Uri.parse('/jmap');
|
||||
final baseUrl = Uri.parse('https://domain.com');
|
||||
final sourceUrl = Uri.parse('/jmap');
|
||||
|
||||
final qualifiedUrlExpected = Uri.parse('https://domain.com/jmap');
|
||||
final qualifiedUrlResult = sourceUrl.toQualifiedUrl(baseUrl: baseUrl);
|
||||
@@ -37,8 +37,8 @@ void main() {
|
||||
});
|
||||
|
||||
test('convertToQualifiedUrl() should return qualified url when baseUrl is `https://domain.com/jmap` and sourceUrl is empty', () async {
|
||||
final baseUrl = Uri.parse('https://domain.com/jmap');
|
||||
final sourceUrl = Uri.parse('');
|
||||
final baseUrl = Uri.parse('https://domain.com/jmap');
|
||||
final sourceUrl = Uri.parse('');
|
||||
|
||||
final qualifiedUrlExpected = Uri.parse('https://domain.com/jmap');
|
||||
final qualifiedUrlResult = sourceUrl.toQualifiedUrl(baseUrl: baseUrl);
|
||||
@@ -47,8 +47,8 @@ void main() {
|
||||
});
|
||||
|
||||
test('convertToQualifiedUrl() should return qualified url when baseUrl is `https://domain.com/jmap` and sourceUrl is `/`', () async {
|
||||
final baseUrl = Uri.parse('https://domain.com/jmap');
|
||||
final sourceUrl = Uri.parse('/');
|
||||
final baseUrl = Uri.parse('https://domain.com/jmap');
|
||||
final sourceUrl = Uri.parse('/');
|
||||
|
||||
final qualifiedUrlExpected = Uri.parse('https://domain.com/jmap');
|
||||
final qualifiedUrlResult = sourceUrl.toQualifiedUrl(baseUrl: baseUrl);
|
||||
@@ -57,8 +57,8 @@ void main() {
|
||||
});
|
||||
|
||||
test('convertToQualifiedUrl() should return qualified url when baseUrl is `https://domain.com:2000/jmap` and sourceUrl is `https://domain.com:2001/jmap`', () async {
|
||||
final baseUrl = Uri.parse('https://domain.com:2000/jmap');
|
||||
final sourceUrl = Uri.parse('https://domain.com:2001/jmap');
|
||||
final baseUrl = Uri.parse('https://domain.com:2000/jmap');
|
||||
final sourceUrl = Uri.parse('https://domain.com:2001/jmap');
|
||||
|
||||
final qualifiedUrlExpected = Uri.parse('https://domain.com:2001/jmap');
|
||||
final qualifiedUrlResult = sourceUrl.toQualifiedUrl(baseUrl: baseUrl);
|
||||
@@ -67,8 +67,8 @@ void main() {
|
||||
});
|
||||
|
||||
test('convertToQualifiedUrl() should return qualified url when baseUrl is `https://domain.com:2000/jmap` and sourceUrl is `https://domain.com:2001/jmap/`', () async {
|
||||
final baseUrl = Uri.parse('https://domain.com:2000/jmap');
|
||||
final sourceUrl = Uri.parse('https://domain.com:2001/jmap/');
|
||||
final baseUrl = Uri.parse('https://domain.com:2000/jmap');
|
||||
final sourceUrl = Uri.parse('https://domain.com:2001/jmap/');
|
||||
|
||||
final qualifiedUrlExpected = Uri.parse('https://domain.com:2001/jmap');
|
||||
final qualifiedUrlResult = sourceUrl.toQualifiedUrl(baseUrl: baseUrl);
|
||||
@@ -77,13 +77,23 @@ void main() {
|
||||
});
|
||||
|
||||
test('convertToQualifiedUrl() should return qualified url when baseUrl is `https://domain.com:20001/jmap` and sourceUrl is `https://domain.com:2001/jmap`', () async {
|
||||
final baseUrl = Uri.parse('https://domain.com:2001/jmap');
|
||||
final sourceUrl = Uri.parse('https://domain.com:2001/jmap');
|
||||
final baseUrl = Uri.parse('https://domain.com:2001/jmap');
|
||||
final sourceUrl = Uri.parse('https://domain.com:2001/jmap');
|
||||
|
||||
final qualifiedUrlExpected = Uri.parse('https://domain.com:2001/jmap');
|
||||
final qualifiedUrlResult = sourceUrl.toQualifiedUrl(baseUrl: baseUrl);
|
||||
|
||||
expect(qualifiedUrlResult, equals(qualifiedUrlExpected));
|
||||
});
|
||||
|
||||
test('convertToQualifiedUrl() should return qualified url when baseUrl is localhost and sourceUrl is `https://domain.com:2001/basiauth/jmap`', () async {
|
||||
final baseUrl = Uri.parse('https://localhost:9080/basicauth');
|
||||
final sourceUrl = Uri.parse('https://domain.com:2001/basicauth/jmap');
|
||||
|
||||
final qualifiedUrlExpected = Uri.parse('https://domain.com:2001/basicauth/jmap');
|
||||
final qualifiedUrlResult = sourceUrl.toQualifiedUrl(baseUrl: baseUrl);
|
||||
|
||||
expect(qualifiedUrlResult, equals(qualifiedUrlExpected));
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user