deal with leading or missing @ and add more tests

This commit is contained in:
Mario Vavti
2026-03-04 10:25:32 +01:00
parent 1f265cc6d5
commit 86d58065b3
5 changed files with 103 additions and 79 deletions

View File

@@ -126,7 +126,7 @@ class NetworkTest extends Zotlabs\Tests\Unit\UnitTestCase {
*
* @dataProvider parse_webbie_provider
*/
public function test_parse_webbie(string $webbie, array $expected) : void {
public function test_parse_webbie(string $webbie, array|false $expected) : void {
$this->assertEquals($expected, parse_webbie($webbie));
}
@@ -138,8 +138,17 @@ class NetworkTest extends Zotlabs\Tests\Unit\UnitTestCase {
// test valid webfinger address with scheme
['acct:test@example.net', ['host' => 'example.net', 'resource' => urlencode('acct:test@example.net')]],
// test address with leading @
['@test@example.net', ['host' => 'example.net', 'resource' => urlencode('acct:test@example.net')]],
// test address with missing user
['@example.net', false],
// test URL
['https://example.net/channel/test', ['host' => 'example.net', 'resource' => urlencode('https://example.net/channel/test')]],
// test unsupported URL
['ftp://example.net/channel/test', false],
];
}