import 'package:feet/api/api.dart'; import 'package:flutter_test/flutter_test.dart'; void main() { group("API", () { test("API key hashing", () { final hash = FeverAPI.generateApiKey("bob", "abcdefgh"); expect(hash, "0fd86d2d609be5de9dce2ac77ad939a4"); }); test("API request builder", () { final api = FeverAPI(apiUrl: "https://deez.org"); final item = Item(api, id: 44, feedId: 4, title: "Morbius", author: "Imposter from Among", html: "

deez

", url: "https://amogus.org", isSaved: true, isRead: false, createdOnTime: DateTime.now()); final request = api .request() .withItems() .withGroups() .withFeeds() .withFavicons() .withIds([1, 2]) .sinceId(69) .maxId(420) .markItem(item, ItemMarkType.read); expect(request.args, [ "items", "groups", "feeds", "favicons", "with_ids=1,2", "since_id=69", "max_id=420", "mark=item", "as=read", "id=44", ]); expect( request.generateUrl(), Uri.parse("https://deez.org?api&items&groups&feeds&favicons&with_ids=1,2&since_id=69&max_id=420&mark=item&as=read&id=44")); }); // TODO: Test item/feed/group/etc constructors }); }