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; return name;
} }
Uri urlFromUsername({required String name}) { String urlFromUsername({required String name}) {
name = cleanUpUsername(name: 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}) { String userFromUsername({required String name}) {
@ -29,7 +29,7 @@ String userFromUsername({required String name}) {
// The first @ is ignored // The first @ is ignored
class Username { class Username {
late final String user; late final String user;
late final Uri url; late final String url;
Username(String username) { Username(String username) {
assert(isValidUsername(name: username)); assert(isValidUsername(name: username));
user = userFromUsername(name: username); user = userFromUsername(name: username);

View File

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

View File

@ -140,13 +140,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.0" version: "2.1.0"
localstorage:
dependency: "direct main"
description:
name: localstorage
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0+1"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:
@ -175,27 +168,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.1" 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: path_provider_linux:
dependency: transitive dependency: transitive
description: description:
@ -203,13 +175,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.7" 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: path_provider_platform_interface:
dependency: transitive dependency: transitive
description: description:

View File

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

View File

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