From 45f720e313044c13977e7da5ef2bb4a84bf004c3 Mon Sep 17 00:00:00 2001 From: zoe Date: Tue, 28 Jun 2022 22:19:46 +0200 Subject: [PATCH] update some tests --- lib/business_logic/user.dart | 6 ++-- macos/Flutter/GeneratedPluginRegistrant.swift | 2 -- pubspec.lock | 35 ------------------- pubspec.yaml | 1 - test/user/user_test.dart | 5 ++- 5 files changed, 5 insertions(+), 44 deletions(-) diff --git a/lib/business_logic/user.dart b/lib/business_logic/user.dart index 9057b38..bba75bb 100644 --- a/lib/business_logic/user.dart +++ b/lib/business_logic/user.dart @@ -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); diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index 766b5cf..8ad28b4 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -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")) } diff --git a/pubspec.lock b/pubspec.lock index 84afb8f..9b9bd34 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -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: diff --git a/pubspec.yaml b/pubspec.yaml index 81bcf58..7412342 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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: diff --git a/test/user/user_test.dart b/test/user/user_test.dart index 1c0a0a1..7d5c933 100644 --- a/test/user/user_test.dart +++ b/test/user/user_test.dart @@ -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"); }); }