update some tests

This commit is contained in:
zoe 2022-06-28 22:19:46 +02:00
parent beaa70fe8b
commit 45f720e313
5 changed files with 5 additions and 44 deletions

View file

@ -15,9 +15,9 @@ String cleanUpUsername({required String name}) {
return name;
}
Uri urlFromUsername({required String name}) {
String urlFromUsername({required String name}) {
name = cleanUpUsername(name: name);
return Uri.parse("https://${name.substring(name.indexOf("@") + 1)}");
return "${name.substring(name.indexOf("@") + 1)}";
}
String userFromUsername({required String name}) {
@ -29,7 +29,7 @@ String userFromUsername({required String name}) {
// The first @ is ignored
class Username {
late final String user;
late final Uri url;
late final String url;
Username(String username) {
assert(isValidUsername(name: username));
user = userFromUsername(name: username);

View file

@ -5,12 +5,10 @@
import FlutterMacOS
import Foundation
import path_provider_macos
import shared_preferences_macos
import url_launcher_macos
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
}

View file

@ -140,13 +140,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
localstorage:
dependency: "direct main"
description:
name: localstorage
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0+1"
matcher:
dependency: transitive
description:
@ -175,27 +168,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
path_provider:
dependency: transitive
description:
name: path_provider
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.11"
path_provider_android:
dependency: transitive
description:
name: path_provider_android
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.16"
path_provider_ios:
dependency: transitive
description:
name: path_provider_ios
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.10"
path_provider_linux:
dependency: transitive
description:
@ -203,13 +175,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.7"
path_provider_macos:
dependency: transitive
description:
name: path_provider_macos
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.6"
path_provider_platform_interface:
dependency: transitive
description:

View file

@ -42,7 +42,6 @@ dependencies:
shared_preferences: ^2.0.15
intl: ^0.17.0
url_launcher: ^6.1.4
localstorage: ^4.0.0+1
dev_dependencies:
flutter_test:

View file

@ -24,9 +24,8 @@ void validUsernameTest() {
void usernameToUrlTest() {
test("try valid transforming usernames into a url", () {
expect(urlFromUsername(name: "hello@example.com"),
Uri.parse("https://example.com"));
expect(urlFromUsername(name: "h@e.c"), Uri.parse("https://e.c"));
expect(urlFromUsername(name: "hello@example.com"), "example.com");
expect(urlFromUsername(name: "h@e.c"), "e.c");
});
}