+ describe "nodeinfo" do
+ setup do
+ [
+ user: insert(:user, ap_id: "https://somewhere.example.com/users/chikichikibanban"),
+ instance:
+ insert(:instance, %{
+ host: "somewhere.example.com",
+ favicon: "https://example.com/favicon.ico"
+ })
+ ]
+ end
+
+ test "is embedded in the account view", %{user: user} do
+ assert %{
+ akkoma: %{
+ instance: %{
+ name: "somewhere.example.com",
+ nodeinfo: %{
+ "version" => "2.0"
+ },
+ favicon: "https://example.com/favicon.ico"
+ }
+ }
+ } = AccountView.render("show.json", %{user: user, skip_visibility_check: true})
+ end
+
+ test "uses local nodeinfo for local users" do
+ user = insert(:user)
+
+ assert %{
+ akkoma: %{
+ instance: %{
+ name: "localhost",
+ nodeinfo: %{
+ software: %{
+ name: "akkoma"
+ }
+ }
+ }
+ }
+ } = AccountView.render("show.json", %{user: user, skip_visibility_check: true})
+ end
+ end
+