flutter time babey

This commit is contained in:
zoe 2022-06-16 22:30:02 +02:00
commit 98798fa14f
134 changed files with 4587 additions and 0 deletions

38
test/user/user_test.dart Normal file
View file

@ -0,0 +1,38 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:slothmu/api/user.dart';
void main() {
validUsernameTest();
usernameToUrlTest();
cleanupNameTest();
}
void validUsernameTest() {
test("test if usernames are valid", () {
expect(isValidUsername(name: "hello world"), false);
expect(isValidUsername(name: ""), false);
expect(isValidUsername(name: "hello@world"), false);
expect(isValidUsername(name: "@hello@world"), false);
expect(isValidUsername(name: "@hello@world."), false);
expect(isValidUsername(name: "@hello@world.example"), true);
expect(isValidUsername(name: "hello@world.example"), true);
expect(isValidUsername(name: "noodles.noodles@gts.example.world.example"),
true);
});
}
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"));
});
}
void cleanupNameTest() {
test("try cleaning up a username", () {
expect(cleanUpUsername(name: "@ s o up @ s oup . par ty "),
"soup@soup.party");
expect(cleanUpUsername(name: ""), "");
});
}

1
test/widget_test.dart Normal file
View file

@ -0,0 +1 @@
void main() {}