// Deep links: only smol:// URIs react, and only the native parser's verdict // decides that — the format rules stay in fumi, not a Dart copy of them. import "package:flutter_test/flutter_test.dart"; import "package:smol_mail/smol/link.dart"; const key = "lm2gqd7e5q67xq3isc5hx6jfj2q7a7xvq4l7trctxipudujovmgq"; void main() { test("self-certifying URI carries its key", () { final link = parseSmolLink("smol://alice@example.org/$key"); expect(link, isNotNull); expect(link!.address.identity, key); expect(link.address.user, "alice"); expect(link.address.host, "example.org"); expect(link.address.port, 1961); expect(link.source, "smol://alice@example.org/$key"); }); test("a non-default port is kept", () { final link = parseSmolLink("smol://alice@example.org:1962/$key"); expect(link!.address.port, 1962); }); test("a smol:// URI without its key is not a link", () { // fumi rejects this form, so a truncated scan acts on nothing rather // than importing a key the sender never signed into. expect(parseSmolLink("smol://alice@example.org"), isNull); }); test("other schemes are not ours", () { expect(parseSmolLink("https://example.org/a"), isNull); expect(parseSmolLink("mailto:alice@example.org"), isNull); }); test("scheme-less addresses are not deep links", () { expect(parseSmolLink("alice@example.org"), isNull); }); test("a smol:// URI the parser rejects is ignored", () { expect(parseSmolLink("smol://not a uri"), isNull); expect(parseSmolLink("smol://alice@example.org/tooshort"), isNull); }); }