From 21e9213c8a65cd8edd5af3e5e3a60caf71dd7cb6 Mon Sep 17 00:00:00 2001 From: Laurent GAY Date: Fri, 21 Nov 2025 17:29:16 +0100 Subject: [PATCH] update library + group test (frontend) - #1815 #1879 --- .gitlab-ci.yml | 16 +++ lib/web/mobilizon_web.ex | 5 +- lib/web/views/error_helpers.ex | 4 +- mix.exs | 23 +-- mix.lock | 21 +-- .../ShareEventModal.spec.ts.snap | 120 +++++++++------- .../__snapshots__/SharePostModal.spec.ts.snap | 60 ++++---- .../views/Group/GroupInvitationJoin.spec.ts | 125 ++++++++++++++++ .../views/Group/GroupInvitations.spec.ts | 135 ++++++++++++++++++ .../specs/views/Group/GroupMembers.spec.ts | 8 +- .../GroupInvitationJoin.spec.ts.snap | 35 +++++ .../GroupInvitations.spec.ts.snap | 50 +++++++ .../__snapshots__/GroupMembers.spec.ts.snap | 38 +---- 13 files changed, 500 insertions(+), 140 deletions(-) create mode 100644 tests/unit/specs/views/Group/GroupInvitationJoin.spec.ts create mode 100644 tests/unit/specs/views/Group/GroupInvitations.spec.ts create mode 100644 tests/unit/specs/views/Group/__snapshots__/GroupInvitationJoin.spec.ts.snap create mode 100644 tests/unit/specs/views/Group/__snapshots__/GroupInvitations.spec.ts.snap diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e841cf17b..fa7ad9dea 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -107,6 +107,22 @@ deps: needs: - install +security-frontend: + stage: check + script: + - npm audit + allow_failure: true + needs: + - install + +security-backend: + stage: check + script: + - mix hex.audit + allow_failure: true + needs: + - install + i18n-frontend: image: python:alpine stage: check diff --git a/lib/web/mobilizon_web.ex b/lib/web/mobilizon_web.ex index 9848b880b..0bb5f0271 100644 --- a/lib/web/mobilizon_web.ex +++ b/lib/web/mobilizon_web.ex @@ -38,8 +38,9 @@ defmodule Mobilizon.Web do namespace: Mobilizon.Web # Use all HTML functionality (forms, tags, etc) - use Phoenix.HTML - + use PhoenixHTMLHelpers + import Phoenix.HTML + import Phoenix.HTML.Form import Phoenix.View import Mobilizon.Web.ErrorHelpers import Mobilizon.Web.Gettext diff --git a/lib/web/views/error_helpers.ex b/lib/web/views/error_helpers.ex index eb63a4d26..ec3a4b585 100644 --- a/lib/web/views/error_helpers.ex +++ b/lib/web/views/error_helpers.ex @@ -3,7 +3,9 @@ defmodule Mobilizon.Web.ErrorHelpers do Conveniences for translating and building error messages. """ - use Phoenix.HTML + import Phoenix.HTML + import Phoenix.HTML.Form + use PhoenixHTMLHelpers @doc """ Translates an error message using gettext. diff --git a/mix.exs b/mix.exs index fee4ae647..d46ec94f4 100644 --- a/mix.exs +++ b/mix.exs @@ -138,13 +138,15 @@ defmodule Mobilizon.Mixfile do # Type `mix help deps` for examples and options. defp deps do [ - {:phoenix, "~> 1.7.0"}, + {:phoenix, "~> 1.8"}, {:phoenix_pubsub, "~> 2.0"}, {:phoenix_ecto, "~> 4.0"}, {:postgrex, ">= 0.17.1"}, - {:phoenix_html, "~> 3.0"}, - {:phoenix_live_view, "~> 0.20.0"}, + {:phoenix_html, "~> 4.0"}, + {:phoenix_html_helpers, "~> 1.0"}, + {:phoenix_live_view, "~> 1.0"}, {:phoenix_view, "~> 2.0"}, + # block by timex {:gettext, "~> 0.24"}, {:guardian, "~> 2.0"}, {:guardian_db, "~> 3.0.0"}, @@ -152,7 +154,7 @@ defmodule Mobilizon.Mixfile do {:argon2_elixir, "~> 4.0"}, {:cors_plug, "~> 3.0"}, {:ecto_autoslug_field, "~> 3.0"}, - {:geo, "~> 3.0"}, + {:geo, "~> 4.1"}, {:geo_postgis, "~> 3.1"}, {:timex, "~> 3.0"}, {:icalendar, github: "mobilizon-tools/icalendar"}, @@ -171,6 +173,7 @@ defmodule Mobilizon.Mixfile do {:absinthe_plug, "~> 1.5.0"}, {:dataloader, "~> 2.0"}, {:atomex, "~> 0.4"}, + # error in "fallback_options" (lib/mobilizon.ex) {:cachex, "~> 3.1"}, {:geohax, "~> 1.0.0"}, {:mogrify, "~> 0.9"}, @@ -193,32 +196,34 @@ defmodule Mobilizon.Mixfile do {:ueberauth_google, "~> 0.12.1"}, {:ueberauth_keycloak_strategy, "~> 0.4.0"}, {:ueberauth_gitlab_strategy, "~> 0.4.0"}, + # depend to httpoison {:ueberauth_cas, "~> 2.0"}, {:ecto_shortuuid, "~> 0.1"}, - {:tesla, "~> 1.8.0"}, + {:tesla, "~> 1.8"}, {:sitemapper, "~> 0.6"}, {:xml_builder, "~> 2.2"}, {:remote_ip, "~> 1.1"}, {:ex_cldr_languages, "~> 0.3.0"}, {:slugger, "~> 0.3"}, - {:sentry, "~> 8.1"}, + {:sentry, "~> 11.0"}, {:html_entities, "~> 0.5"}, {:sweet_xml, "~> 0.7"}, {:web_push_encryption, github: "danhper/elixir-web-push-encryption"}, {:eblurhash, "~> 1.2.0"}, {:struct_access, "~> 1.1.2"}, - {:paasaa, "~> 0.6.0"}, + {:paasaa, "~> 1.0.0"}, {:nimble_csv, "~> 1.1"}, {:export, "~> 0.1.0"}, {:erlport, "~> 0.11.0"}, - {:tz_world, "~> 1.3.0"}, + {:tz_world, "~> 1.4"}, {:tzdata, "~> 1.1"}, {:codepagex, "~> 0.1.6"}, {:vite_phx, "~> 0.2"}, - {:unplug, "~> 1.0.0"}, + {:unplug, "~> 1.1.0"}, {:replug, "~> 0.1.0"}, {:exkismet, github: "tcitworld/exkismet"}, {:rajska, github: "tcitworld/rajska", branch: "mobilizon"}, + # block by tcitworld/rajska fork {:hammer, "~> 6.1"}, {:tls_certificate_check, "~> 1.20"}, {:bandit, "~> 1.0"}, diff --git a/mix.lock b/mix.lock index e5c2b4f73..d0b1ff513 100644 --- a/mix.lock +++ b/mix.lock @@ -1,5 +1,5 @@ %{ - "absinthe": {:hex, :absinthe, "1.8.0", "c2d941e951210ebd2494b4263d4354ca0a6d886d6dbf0cefaa21fe716a888a95", [:mix], [{:dataloader, "~> 1.0.0 or ~> 2.0", [hex: :dataloader, repo: "hexpm", optional: true]}, {:decimal, "~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}, {:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}, {:opentelemetry_process_propagator, "~> 0.2.1 or ~> 0.3", [hex: :opentelemetry_process_propagator, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "0ac63d2f07db21913e58d662e4415768986e1bd0d2cd48e2417cfe200441161b"}, + "absinthe": {:hex, :absinthe, "1.9.0", "28f11753d01c0e8b6cb6e764a23cf4081e0e6cae88f53f4c9e4320912aee9c07", [:mix], [{:dataloader, "~> 1.0.0 or ~> 2.0", [hex: :dataloader, repo: "hexpm", optional: true]}, {:decimal, "~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}, {:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}, {:opentelemetry_process_propagator, "~> 0.2.1 or ~> 0.3", [hex: :opentelemetry_process_propagator, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "db65993420944ad90e932827663d4ab704262b007d4e3900cd69615f14ccc8ce"}, "absinthe_phoenix": {:hex, :absinthe_phoenix, "2.0.3", "74e0862f280424b7bc290f6f69e133268bce0b4e7db0218c7e129c5c2b1d3fd4", [:mix], [{:absinthe, "~> 1.5", [hex: :absinthe, repo: "hexpm", optional: false]}, {:absinthe_plug, "~> 1.5", [hex: :absinthe_plug, repo: "hexpm", optional: false]}, {:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.5", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.13 or ~> 3.0 or ~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.0", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}], "hexpm", "caffaea03c17ea7419fe07e4bc04c2399c47f0d8736900623dbf4749a826fd2c"}, "absinthe_plug": {:hex, :absinthe_plug, "1.5.9", "4f66fd46aecf969b349dd94853e6132db6d832ae6a4b951312b6926ad4ee7ca3", [:mix], [{:absinthe, "~> 1.7", [hex: :absinthe, repo: "hexpm", optional: false]}, {:plug, "~> 1.4", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "dcdc84334b0e9e2cd439bd2653678a822623f212c71088edf0a4a7d03f1fa225"}, "argon2_elixir": {:hex, :argon2_elixir, "4.1.3", "4f28318286f89453364d7fbb53e03d4563fd7ed2438a60237eba5e426e97785f", [:make, :mix], [{:comeonin, "~> 5.3", [hex: :comeonin, repo: "hexpm", optional: false]}, {:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "7c295b8d8e0eaf6f43641698f962526cdf87c6feb7d14bd21e599271b510608c"}, @@ -59,7 +59,7 @@ "file_system": {:hex, :file_system, "1.1.1", "31864f4685b0148f25bd3fbef2b1228457c0c89024ad67f7a81a3ffbc0bbad3a", [:mix], [], "hexpm", "7a15ff97dfe526aeefb090a7a9d3d03aa907e100e262a0f8f7746b78f8f87a5d"}, "floki": {:hex, :floki, "0.38.0", "62b642386fa3f2f90713f6e231da0fa3256e41ef1089f83b6ceac7a3fd3abf33", [:mix], [], "hexpm", "a5943ee91e93fb2d635b612caf5508e36d37548e84928463ef9dd986f0d1abd9"}, "gen_smtp": {:hex, :gen_smtp, "1.3.0", "62c3d91f0dcf6ce9db71bcb6881d7ad0d1d834c7f38c13fa8e952f4104a8442e", [:rebar3], [{:ranch, ">= 1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "0b73fbf069864ecbce02fe653b16d3f35fd889d0fdd4e14527675565c39d84e6"}, - "geo": {:hex, :geo, "3.6.0", "00c9c6338579f67e91cd5950af4ae2eb25cdce0c3398718c232539f61625d0bd", [:mix], [{:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "1dbdebf617183b54bc3c8ad7a36531a9a76ada8ca93f75f573b0ae94006168da"}, + "geo": {:hex, :geo, "4.1.0", "64ba89a64cc400b5b16dd2f5bd644cb141776eb8c2ac5a983332c8d944936c12", [:mix], [{:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "19edb2b3398ca9f701b573b1fb11bc90951ebd64f18b06bd1bf35abe509a2934"}, "geo_postgis": {:hex, :geo_postgis, "3.7.1", "614f25b42334a615bd54bb09c22030b1aac7bac8f829bd823ab1faccf093a324", [:mix], [{:ecto, "~> 3.0", [hex: :ecto, repo: "hexpm", optional: true]}, {:geo, "~> 3.6 or ~> 4.0", [hex: :geo, repo: "hexpm", optional: false]}, {:jason, "~> 1.2", [hex: :jason, repo: "hexpm", optional: true]}, {:poison, "~> 2.2 or ~> 3.0 or ~> 4.0 or ~> 5.0 or ~> 6.0", [hex: :poison, repo: "hexpm", optional: true]}, {:postgrex, ">= 0.0.0", [hex: :postgrex, repo: "hexpm", optional: false]}], "hexpm", "c20d823c600d35b7fe9ddd5be03052bb7136c57d6f1775dbd46871545e405280"}, "geohax": {:hex, :geohax, "1.0.2", "30d046e413d3e8e6a5044ad045ed5db1fbcb6ea203d44fc1782188e95a18079a", [:mix], [], "hexpm", "4c782de1e1ee781e2fa07ba6ebfbfb66b91c215b901073defe6196184b8b60a4"}, "geolix": {:hex, :geolix, "2.0.0", "7e65764bedfc98d08a3ddb24c417657c9d438eff163280b45fbb7de289626acd", [:mix], [], "hexpm", "8742bf588ed0bb7def2c443204d09d355990846c6efdff96ded66aac24c301df"}, @@ -105,13 +105,14 @@ "oauth2": {:hex, :oauth2, "2.1.0", "beb657f393814a3a7a8a15bd5e5776ecae341fd344df425342a3b6f1904c2989", [:mix], [{:tesla, "~> 1.5", [hex: :tesla, repo: "hexpm", optional: false]}], "hexpm", "8ac07f85b3307dd1acfeb0ec852f64161b22f57d0ce0c15e616a1dfc8ebe2b41"}, "oauther": {:hex, :oauther, "1.3.0", "82b399607f0ca9d01c640438b34d74ebd9e4acd716508f868e864537ecdb1f76", [:mix], [], "hexpm", "78eb888ea875c72ca27b0864a6f550bc6ee84f2eeca37b093d3d833fbcaec04e"}, "oban": {:hex, :oban, "2.20.1", "39d0b68787e5cf251541c0d657a698f6142a24d8744e1e40b2cf045d4fa232a6", [:mix], [{:ecto_sql, "~> 3.10", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:ecto_sqlite3, "~> 0.9", [hex: :ecto_sqlite3, repo: "hexpm", optional: true]}, {:igniter, "~> 0.5", [hex: :igniter, repo: "hexpm", optional: true]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: true]}, {:myxql, "~> 0.7", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.20", [hex: :postgrex, repo: "hexpm", optional: true]}, {:telemetry, "~> 1.3", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "17a45277dbeb41a455040b41dd8c467163fad685d1366f2f59207def3bcdd1d8"}, - "paasaa": {:hex, :paasaa, "0.6.0", "07c8ed81010caa25db351d474f0c053072c809821c60f9646f7b1547bec52f6d", [:mix], [], "hexpm", "732ddfc21bac0831edb26aec468af3ec2b8997d74f6209810b1cc53199c29f2e"}, + "paasaa": {:hex, :paasaa, "1.0.0", "98715e13a9c928659af9b09fbf0eeca42bbcc91c63190301932026b21e6a7c11", [:mix], [], "hexpm", "709262e8df8fa3b93e502c04d255a63d8729e609d9eb7fc42b9479f3f98e02b7"}, "parse_trans": {:hex, :parse_trans, "3.4.1", "6e6aa8167cb44cc8f39441d05193be6e6f4e7c2946cb2759f015f8c56b76e5ff", [:rebar3], [], "hexpm", "620a406ce75dada827b82e453c19cf06776be266f5a67cff34e1ef2cbb60e49a"}, - "phoenix": {:hex, :phoenix, "1.7.21", "14ca4f1071a5f65121217d6b57ac5712d1857e40a0833aff7a691b7870fc9a3b", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.1", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: true]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.7", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:plug_crypto, "~> 1.2 or ~> 2.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}, {:websock_adapter, "~> 0.5.3", [hex: :websock_adapter, repo: "hexpm", optional: false]}], "hexpm", "336dce4f86cba56fed312a7d280bf2282c720abb6074bdb1b61ec8095bdd0bc9"}, + "phoenix": {:hex, :phoenix, "1.8.1", "865473a60a979551a4879db79fbfb4503e41cd809e77c85af79716578b6a456d", [:mix], [{:bandit, "~> 1.0", [hex: :bandit, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.1", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: true]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.7", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:plug_crypto, "~> 1.2 or ~> 2.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}, {:websock_adapter, "~> 0.5.3", [hex: :websock_adapter, repo: "hexpm", optional: false]}], "hexpm", "84d77d2b2e77c3c7e7527099bd01ef5c8560cd149c036d6b3a40745f11cd2fb2"}, "phoenix_ecto": {:hex, :phoenix_ecto, "4.7.0", "75c4b9dfb3efdc42aec2bd5f8bccd978aca0651dbcbc7a3f362ea5d9d43153c6", [:mix], [{:ecto, "~> 3.5", [hex: :ecto, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.14.2 or ~> 3.0 or ~> 4.1", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:plug, "~> 1.9", [hex: :plug, repo: "hexpm", optional: false]}, {:postgrex, "~> 0.16 or ~> 1.0", [hex: :postgrex, repo: "hexpm", optional: true]}], "hexpm", "1d75011e4254cb4ddf823e81823a9629559a1be93b4321a6a5f11a5306fbf4cc"}, - "phoenix_html": {:hex, :phoenix_html, "3.3.4", "42a09fc443bbc1da37e372a5c8e6755d046f22b9b11343bf885067357da21cb3", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "0249d3abec3714aff3415e7ee3d9786cb325be3151e6c4b3021502c585bf53fb"}, + "phoenix_html": {:hex, :phoenix_html, "4.3.0", "d3577a5df4b6954cd7890c84d955c470b5310bb49647f0a114a6eeecc850f7ad", [:mix], [], "hexpm", "3eaa290a78bab0f075f791a46a981bbe769d94bc776869f4f3063a14f30497ad"}, + "phoenix_html_helpers": {:hex, :phoenix_html_helpers, "1.0.1", "7eed85c52eff80a179391036931791ee5d2f713d76a81d0d2c6ebafe1e11e5ec", [:mix], [{:phoenix_html, "~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "cffd2385d1fa4f78b04432df69ab8da63dc5cf63e07b713a4dcf36a3740e3090"}, "phoenix_live_reload": {:hex, :phoenix_live_reload, "1.6.1", "05df733a09887a005ed0d69a7fc619d376aea2730bf64ce52ac51ce716cc1ef0", [:mix], [{:file_system, "~> 0.2.10 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.4", [hex: :phoenix, repo: "hexpm", optional: false]}], "hexpm", "74273843d5a6e4fef0bbc17599f33e3ec63f08e69215623a0cd91eea4288e5a0"}, - "phoenix_live_view": {:hex, :phoenix_live_view, "0.20.17", "f396bbdaf4ba227b82251eb75ac0afa6b3da5e509bc0d030206374237dfc9450", [:mix], [{:floki, "~> 0.36", [hex: :floki, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix, "~> 1.6.15 or ~> 1.7.0", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 3.3 or ~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: true]}, {:plug, "~> 1.15", [hex: :plug, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.2 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "a61d741ffb78c85fdbca0de084da6a48f8ceb5261a79165b5a0b59e5f65ce98b"}, + "phoenix_live_view": {:hex, :phoenix_live_view, "1.1.17", "1d782b5901cf13b137c6d8c56542ff6cb618359b2adca7e185b21df728fa0c6c", [:mix], [{:igniter, ">= 0.6.16 and < 1.0.0-0", [hex: :igniter, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:lazy_html, "~> 0.1.0", [hex: :lazy_html, repo: "hexpm", optional: true]}, {:phoenix, "~> 1.6.15 or ~> 1.7.0 or ~> 1.8.0-rc", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 3.3 or ~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: true]}, {:plug, "~> 1.15", [hex: :plug, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.2 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "fa82307dd9305657a8236d6b48e60ef2e8d9f742ee7ed832de4b8bcb7e0e5ed2"}, "phoenix_pubsub": {:hex, :phoenix_pubsub, "2.2.0", "ff3a5616e1bed6804de7773b92cbccfc0b0f473faf1f63d7daf1206c7aeaaa6f", [:mix], [], "hexpm", "adc313a5bf7136039f63cfd9668fde73bba0765e0614cba80c06ac9460ff3e96"}, "phoenix_swoosh": {:hex, :phoenix_swoosh, "1.2.1", "b74ccaa8046fbc388a62134360ee7d9742d5a8ae74063f34eb050279de7a99e1", [:mix], [{:finch, "~> 0.8", [hex: :finch, repo: "hexpm", optional: true]}, {:hackney, "~> 1.10", [hex: :hackney, repo: "hexpm", optional: true]}, {:phoenix, "~> 1.6", [hex: :phoenix, repo: "hexpm", optional: true]}, {:phoenix_html, "~> 3.0 or ~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:phoenix_view, "~> 1.0 or ~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: false]}, {:swoosh, "~> 1.5", [hex: :swoosh, repo: "hexpm", optional: false]}], "hexpm", "4000eeba3f9d7d1a6bf56d2bd56733d5cadf41a7f0d8ffe5bb67e7d667e204a2"}, "phoenix_template": {:hex, :phoenix_template, "1.0.4", "e2092c132f3b5e5b2d49c96695342eb36d0ed514c5b252a77048d5969330d639", [:mix], [{:phoenix_html, "~> 2.14.2 or ~> 3.0 or ~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}], "hexpm", "2c0c81f0e5c6753faf5cca2f229c9709919aba34fab866d3bc05060c9c444206"}, @@ -125,7 +126,7 @@ "ranch": {:hex, :ranch, "2.2.0", "25528f82bc8d7c6152c57666ca99ec716510fe0925cb188172f41ce93117b1b0", [:make, :rebar3], [], "hexpm", "fa0b99a1780c80218a4197a59ea8d3bdae32fbff7e88527d7d8a4787eff4f8e7"}, "remote_ip": {:hex, :remote_ip, "1.2.0", "fb078e12a44414f4cef5a75963c33008fe169b806572ccd17257c208a7bc760f", [:mix], [{:combine, "~> 0.10", [hex: :combine, repo: "hexpm", optional: false]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "2ff91de19c48149ce19ed230a81d377186e4412552a597d6a5137373e5877cb7"}, "replug": {:hex, :replug, "0.1.0", "61d35f8c873c0078a23c49579a48f36e45789414b1ec0daee3fd5f4e34221f23", [:mix], [{:plug, "~> 1.8", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "f71f7a57e944e854fe4946060c6964098e53958074c69fb844b96e0bd58cfa60"}, - "sentry": {:hex, :sentry, "8.1.0", "8d235b62fce5f8e067ea1644e30939405b71a5e1599d9529ff82899d11d03f2b", [:mix], [{:hackney, "~> 1.8", [hex: :hackney, repo: "hexpm", optional: true]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: true]}, {:plug, "~> 1.6", [hex: :plug, repo: "hexpm", optional: true]}, {:plug_cowboy, "~> 2.3", [hex: :plug_cowboy, repo: "hexpm", optional: true]}], "hexpm", "f9fc7641ef61e885510f5e5963c2948b9de1de597c63f781e9d3d6c9c8681ab4"}, + "sentry": {:hex, :sentry, "11.0.4", "60371c96cefd247e0fc98840bba2648f64f19aa0b8db8e938f5a98421f55b619", [:mix], [{:hackney, "~> 1.8", [hex: :hackney, repo: "hexpm", optional: true]}, {:igniter, "~> 0.5", [hex: :igniter, repo: "hexpm", optional: true]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: true]}, {:nimble_options, "~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:nimble_ownership, "~> 0.3.0 or ~> 1.0", [hex: :nimble_ownership, repo: "hexpm", optional: false]}, {:opentelemetry, ">= 0.0.0", [hex: :opentelemetry, repo: "hexpm", optional: true]}, {:opentelemetry_api, ">= 0.0.0", [hex: :opentelemetry_api, repo: "hexpm", optional: true]}, {:opentelemetry_exporter, ">= 0.0.0", [hex: :opentelemetry_exporter, repo: "hexpm", optional: true]}, {:opentelemetry_semantic_conventions, ">= 0.0.0", [hex: :opentelemetry_semantic_conventions, repo: "hexpm", optional: true]}, {:phoenix, "~> 1.6", [hex: :phoenix, repo: "hexpm", optional: true]}, {:phoenix_live_view, "~> 0.20 or ~> 1.0", [hex: :phoenix_live_view, repo: "hexpm", optional: true]}, {:plug, "~> 1.6", [hex: :plug, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: true]}], "hexpm", "feaafc284dc204c82aadaddc884227aeaa3480decb274d30e184b9d41a700c66"}, "shortuuid": {:hex, :shortuuid, "4.1.0", "6f59470b78169c84a0cedbbe3fd4e83f0837a59877a4e1a7c0709916d54239e2", [:mix], [], "hexpm", "7336719118b3cca1ac73e95810199b0b9b7d00f9d71bd2c2d27fed4c4f74388e"}, "sitemapper": {:hex, :sitemapper, "0.10.0", "d9fab068f55f1f64adb8ebbb66942c6231c192740c15ae599a70e346a2ff9da1", [:mix], [{:ex_aws_s3, "~> 2.0", [hex: :ex_aws_s3, repo: "hexpm", optional: true]}, {:google_api_storage, "~> 0.34", [hex: :google_api_storage, repo: "hexpm", optional: true]}, {:xml_builder, "~> 2.1", [hex: :xml_builder, repo: "hexpm", optional: false]}], "hexpm", "89ef80f04e4092cb3a8cbcf37520fa31784cc07104c0b47354539e38d2e62443"}, "sleeplocks": {:hex, :sleeplocks, "1.1.3", "96a86460cc33b435c7310dbd27ec82ca2c1f24ae38e34f8edde97f756503441a", [:rebar3], [], "hexpm", "d3b3958552e6eb16f463921e70ae7c767519ef8f5be46d7696cc1ed649421321"}, @@ -137,11 +138,11 @@ "sweet_xml": {:hex, :sweet_xml, "0.7.5", "803a563113981aaac202a1dbd39771562d0ad31004ddbfc9b5090bdcd5605277", [:mix], [], "hexpm", "193b28a9b12891cae351d81a0cead165ffe67df1b73fe5866d10629f4faefb12"}, "swoosh": {:hex, :swoosh, "1.19.8", "0576f2ea96d1bb3a6e02cc9f79cbd7d497babc49a353eef8dce1a1f9f82d7915", [:mix], [{:bandit, ">= 1.0.0", [hex: :bandit, repo: "hexpm", optional: true]}, {:cowboy, "~> 1.1 or ~> 2.4", [hex: :cowboy, repo: "hexpm", optional: true]}, {:ex_aws, "~> 2.1", [hex: :ex_aws, repo: "hexpm", optional: true]}, {:finch, "~> 0.6", [hex: :finch, repo: "hexpm", optional: true]}, {:gen_smtp, "~> 0.13 or ~> 1.0", [hex: :gen_smtp, repo: "hexpm", optional: true]}, {:hackney, "~> 1.9", [hex: :hackney, repo: "hexpm", optional: true]}, {:idna, "~> 6.0", [hex: :idna, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:mail, "~> 0.2", [hex: :mail, repo: "hexpm", optional: true]}, {:mime, "~> 1.1 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mua, "~> 0.2.3", [hex: :mua, repo: "hexpm", optional: true]}, {:multipart, "~> 0.4", [hex: :multipart, repo: "hexpm", optional: true]}, {:plug, "~> 1.9", [hex: :plug, repo: "hexpm", optional: true]}, {:plug_cowboy, ">= 1.0.0", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:req, "~> 0.5.10 or ~> 0.6 or ~> 1.0", [hex: :req, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.2 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "d7503c2daf0f9899afd8eba9923eeddef4b62e70816e1d3b6766e4d6c60e94ad"}, "telemetry": {:hex, :telemetry, "1.3.0", "fedebbae410d715cf8e7062c96a1ef32ec22e764197f70cda73d82778d61e7a2", [:rebar3], [], "hexpm", "7015fc8919dbe63764f4b4b87a95b7c0996bd539e0d499be6ec9d7f3875b79e6"}, - "tesla": {:hex, :tesla, "1.8.1", "db98853345cf2ae6fea1b9c31dc6d5ccca7856889b936436f245f86153babbbf", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:exjsx, ">= 3.0.0", [hex: :exjsx, repo: "hexpm", optional: true]}, {:finch, "~> 0.13", [hex: :finch, repo: "hexpm", optional: true]}, {:fuse, "~> 2.4", [hex: :fuse, repo: "hexpm", optional: true]}, {:gun, ">= 1.0.0", [hex: :gun, repo: "hexpm", optional: true]}, {:hackney, "~> 1.6", [hex: :hackney, repo: "hexpm", optional: true]}, {:ibrowse, "4.4.2", [hex: :ibrowse, repo: "hexpm", optional: true]}, {:jason, ">= 1.0.0", [hex: :jason, repo: "hexpm", optional: true]}, {:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 1.0", [hex: :mint, repo: "hexpm", optional: true]}, {:msgpax, "~> 2.3", [hex: :msgpax, repo: "hexpm", optional: true]}, {:poison, ">= 1.0.0", [hex: :poison, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: true]}], "hexpm", "8282a97d9297b157c22afe12ccbf0a4f145e4de47dbd3ec30d4ce14f1d87fdf8"}, + "tesla": {:hex, :tesla, "1.15.3", "3a2b5c37f09629b8dcf5d028fbafc9143c0099753559d7fe567eaabfbd9b8663", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:exjsx, ">= 3.0.0", [hex: :exjsx, repo: "hexpm", optional: true]}, {:finch, "~> 0.13", [hex: :finch, repo: "hexpm", optional: true]}, {:fuse, "~> 2.4", [hex: :fuse, repo: "hexpm", optional: true]}, {:gun, ">= 1.0.0", [hex: :gun, repo: "hexpm", optional: true]}, {:hackney, "~> 1.21", [hex: :hackney, repo: "hexpm", optional: true]}, {:ibrowse, "4.4.2", [hex: :ibrowse, repo: "hexpm", optional: true]}, {:jason, ">= 1.0.0", [hex: :jason, repo: "hexpm", optional: true]}, {:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 1.0", [hex: :mint, repo: "hexpm", optional: true]}, {:mox, "~> 1.0", [hex: :mox, repo: "hexpm", optional: true]}, {:msgpax, "~> 2.3", [hex: :msgpax, repo: "hexpm", optional: true]}, {:poison, ">= 1.0.0", [hex: :poison, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: true]}], "hexpm", "98bb3d4558abc67b92fb7be4cd31bb57ca8d80792de26870d362974b58caeda7"}, "thousand_island": {:hex, :thousand_island, "1.4.2", "735fa783005d1703359bbd2d3a5a3a398075ba4456e5afe3c5b7cf4666303d36", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "1c7637f16558fc1c35746d5ee0e83b18b8e59e18d28affd1f2fa1645f8bc7473"}, "timex": {:hex, :timex, "3.7.13", "0688ce11950f5b65e154e42b47bf67b15d3bc0e0c3def62199991b8a8079a1e2", [:mix], [{:combine, "~> 0.10", [hex: :combine, repo: "hexpm", optional: false]}, {:gettext, "~> 0.26", [hex: :gettext, repo: "hexpm", optional: false]}, {:tzdata, "~> 1.1", [hex: :tzdata, repo: "hexpm", optional: false]}], "hexpm", "09588e0522669328e973b8b4fd8741246321b3f0d32735b589f78b136e6d4c54"}, "tls_certificate_check": {:hex, :tls_certificate_check, "1.30.0", "ef9bdfcb5b551b747cad231a65ebd449623628bb72471c1d2aefcbbc5730683d", [:rebar3], [{:ssl_verify_fun, "~> 1.1", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm", "dfbada8fddb80ae19b8aeaac34d95cfce98c91393b0db9c3ee079b488fd68d81"}, - "tz_world": {:hex, :tz_world, "1.3.3", "6d847a8f24d84f091d3385769dad96a27170e8e9a03f5ded9fd86299a99c67b1", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:certifi, "~> 2.5", [hex: :certifi, repo: "hexpm", optional: true]}, {:geo, "~> 1.0 or ~> 2.0 or ~> 3.3", [hex: :geo, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "dae9f255954c767fa4e36fa68b2927310a7192b525e10f860a6f4656aab23746"}, + "tz_world": {:hex, :tz_world, "1.4.1", "ff9c9819b20f443d47e6e0dc412e15c23be5bb6ac856e8d83c4163ccbc55b52f", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:certifi, "~> 2.5", [hex: :certifi, repo: "hexpm", optional: true]}, {:geo, "~> 1.0 or ~> 2.0 or ~> 3.3 or ~> 4.0", [hex: :geo, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "9173ba7aa7c5e627e23adfc0c8d001a56a7072d5bdc8d3a94e4cd44e25decba1"}, "tzdata": {:hex, :tzdata, "1.1.3", "b1cef7bb6de1de90d4ddc25d33892b32830f907e7fc2fccd1e7e22778ab7dfbc", [:mix], [{:hackney, "~> 1.17", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "d4ca85575a064d29d4e94253ee95912edfb165938743dbf002acdf0dcecb0c28"}, "ueberauth": {:hex, :ueberauth, "0.10.8", "ba78fbcbb27d811a6cd06ad851793aaf7d27c3b30c9e95349c2c362b344cd8f0", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "f2d3172e52821375bccb8460e5fa5cb91cfd60b19b636b6e57e9759b6f8c10c1"}, "ueberauth_cas": {:hex, :ueberauth_cas, "2.3.1", "df45a1f2c5df8bc80191cbca4baeeed808d697702ec5ebe5bd5d5a264481752f", [:mix], [{:httpoison, "~> 1.8", [hex: :httpoison, repo: "hexpm", optional: false]}, {:sweet_xml, "~> 0.7", [hex: :sweet_xml, repo: "hexpm", optional: false]}, {:ueberauth, "~> 0.6", [hex: :ueberauth, repo: "hexpm", optional: false]}], "hexpm", "5068ae2b9e217c2f05aa9a67483a6531e21ba0be9a6f6c8749bb7fd1599be321"}, @@ -153,7 +154,7 @@ "ueberauth_keycloak_strategy": {:hex, :ueberauth_keycloak_strategy, "0.4.0", "51e975874564ef4a6eb0044b9f0c6a08be4ba6086e62e41d385e7dd52fe9568b", [:mix], [{:oauth2, "~> 2.0", [hex: :oauth2, repo: "hexpm", optional: false]}, {:ueberauth, "~> 0.7", [hex: :ueberauth, repo: "hexpm", optional: false]}], "hexpm", "c03027937bddcbd9ff499e457f9bb05f79018fa321abf79ebcfed2af0007211b"}, "ueberauth_twitter": {:hex, :ueberauth_twitter, "0.4.1", "92f88b1ad50322cdda719b439bb7f93b225dc0315723117bc25c782e627c8f33", [:mix], [{:httpoison, "~> 1.0", [hex: :httpoison, repo: "hexpm", optional: false]}, {:oauther, "~> 1.1", [hex: :oauther, repo: "hexpm", optional: false]}, {:ueberauth, "~> 0.7", [hex: :ueberauth, repo: "hexpm", optional: false]}], "hexpm", "83ca8ea3e1a3f976f1adbebfb323b9ebf53af453fbbf57d0486801a303b16065"}, "unicode_util_compat": {:hex, :unicode_util_compat, "0.7.1", "a48703a25c170eedadca83b11e88985af08d35f37c6f664d6dcfb106a97782fc", [:rebar3], [], "hexpm", "b3a917854ce3ae233619744ad1e0102e05673136776fb2fa76234f3e03b23642"}, - "unplug": {:hex, :unplug, "1.0.0", "8ec2479de0baa9a6283c04a1cc616c5ca6c5b80b8ff1d857481bb2943368dbbc", [:mix], [{:plug, "~> 1.8", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "d171a85758aa412d4e85b809c203e1b1c4c76a4d6ab58e68dc9a8a8acd9b7c3a"}, + "unplug": {:hex, :unplug, "1.1.0", "acd8c40dfda63a831b01534307c8cc44726389429294a5ed44d7f89fb01ccd02", [:mix], [{:plug, "~> 1.8", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "a3b302125ed60b658a9a7c0dff6941050bfc56dc77a0bca72facdb743159898f"}, "unsafe": {:hex, :unsafe, "1.0.2", "23c6be12f6c1605364801f4b47007c0c159497d0446ad378b5cf05f1855c0581", [:mix], [], "hexpm", "b485231683c3ab01a9cd44cb4a79f152c6f3bb87358439c6f68791b85c2df675"}, "vite_phx": {:hex, :vite_phx, "0.3.2", "4c767b05574bebaae991592b9390c3ac004c8c01300bb20960070c07a5fdb9c2", [:mix], [{:jason, ">= 0.0.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix, ">= 0.0.0", [hex: :phoenix, repo: "hexpm", optional: false]}], "hexpm", "43e95d2d80e0cb62c33fc6db4aa6a6135efe1a70395c85a44bdc855da01587ba"}, "web_push_encryption": {:git, "https://github.com/danhper/elixir-web-push-encryption.git", "6e143dcde0a2854c4f0d72816b7ecab696432779", []}, diff --git a/tests/unit/specs/components/Event/__snapshots__/ShareEventModal.spec.ts.snap b/tests/unit/specs/components/Event/__snapshots__/ShareEventModal.spec.ts.snap index 470610681..35fb9fa22 100644 --- a/tests/unit/specs/components/Event/__snapshots__/ShareEventModal.spec.ts.snap +++ b/tests/unit/specs/components/Event/__snapshots__/ShareEventModal.spec.ts.snap @@ -20,20 +20,24 @@ exports[`ShareEventModal > Show Cancelled 1`] = `
-
- - - +
+
+
+ + + +
+

+

+
+ + + + + +

+
-

-

-
- - - - - -

@@ -63,20 +67,24 @@ exports[`ShareEventModal > Show No seats left 1`] = `
-
- - - +
+
+
+ + + +
+

+

+
+ + + + + +

+
-

-

-
- - - - - -

@@ -106,20 +114,24 @@ exports[`ShareEventModal > Show Private 1`] = `
-
- - - +
+
+
+ + + +
+

+

+
+ + + + + +

+
-

-

-
- - - - - -

@@ -138,20 +150,24 @@ exports[`ShareEventModal > Show Public 1`] = `
-
- - - +
+
+
+ + + +
+

+

+
+ + + + + +

+
-

-

-
- - - - - -

diff --git a/tests/unit/specs/components/Post/__snapshots__/SharePostModal.spec.ts.snap b/tests/unit/specs/components/Post/__snapshots__/SharePostModal.spec.ts.snap index e57c3e84e..99a2b22b0 100644 --- a/tests/unit/specs/components/Post/__snapshots__/SharePostModal.spec.ts.snap +++ b/tests/unit/specs/components/Post/__snapshots__/SharePostModal.spec.ts.snap @@ -8,20 +8,24 @@ exports[`SharePostModal > Show private 1`] = `
-
- - - +
+
+
+ + + +
+

+

+
+ + + + + +

+
-

-

-
- - - - - -

@@ -38,20 +42,24 @@ exports[`SharePostModal > Show public 1`] = `
-
- - - +
+
+
+ + + +
+

+

+
+ + + + + +

+
-

-

-
- - - - - -

diff --git a/tests/unit/specs/views/Group/GroupInvitationJoin.spec.ts b/tests/unit/specs/views/Group/GroupInvitationJoin.spec.ts new file mode 100644 index 000000000..e5a7c9ab3 --- /dev/null +++ b/tests/unit/specs/views/Group/GroupInvitationJoin.spec.ts @@ -0,0 +1,125 @@ +import { beforeEach, describe, it, expect, vi } from "vitest"; +import { enUS } from "date-fns/locale"; +import { routes } from "@/router"; +import { createRouter, createWebHistory, Router } from "vue-router"; +import { config, mount } from "@vue/test-utils"; +import { Oruga } from "@oruga-ui/oruga-next"; +import flushPromises from "flush-promises"; +import { getMockClient, requestHandlers } from "../../mocks/client"; +import { htmlRemoveId } from "../../common"; +import GroupInvitationJoin from "@/views/Group/GroupInvitationJoin.vue"; +import { GROUP_INVITATIONS_ACCEPT } from "@/graphql/invitations"; +import { FETCH_GROUP_PUBLIC } from "@/graphql/group"; +import { computed } from "vue"; + +vi.mock("@/composition/apollo/actor", () => { + return { + useCurrentActorClient: () => { + const error = null; + const loading = null; + const currentActor = computed(() => { + return { + id: 123, + name: "test", + domain: null, + preferredUsername: "test", + }; + }); + return { currentActor, error, loading }; + }, + }; +}); + +config.global.plugins.push(Oruga); + +let router: Router; + +beforeEach(async () => { + router = createRouter({ + history: createWebHistory(), + routes: routes, + }); + + // await router.isReady(); +}); + +const mock_group = { + data: { + group: { + __typename: "Group", + avatar: null, + banner: null, + domain: null, + id: "123", + manuallyApprovesFollowers: true, + allowSeeParticipants: false, + members: { + __typename: "PaginatedMemberList", + total: 1, + }, + name: "ssss", + openness: "MODERATED", + organizedEvents: { + __typename: "PaginatedEventList", + elements: [], + total: 0, + }, + physicalAddress: null, + posts: { + __typename: "PaginatedPostList", + elements: [], + total: 0, + }, + preferredUsername: "example", + summary: null, + suspended: false, + type: "GROUP", + url: "https://mobilizon.test/@example", + visibility: "PUBLIC", + }, + }, +}; + +const generateWrapper = () => { + const global_data = getMockClient([ + [FETCH_GROUP_PUBLIC, mock_group], + GROUP_INVITATIONS_ACCEPT, + ]); + global_data.provide.dateFnsLocale = enUS; + global_data.plugins = [router]; + return mount(GroupInvitationJoin, { + props: { + preferredUsername: "mygroup", + token: "dhfqjkhesfkhqdkjsqfkjds", + }, + global: { + ...global_data, + stubs: { + RouterLink: false, + }, + }, + }); +}; + +describe("GroupInvitationJoin", () => { + it("Show simple", async () => { + const wrapper = generateWrapper(); + await wrapper.vm.$nextTick(); + await flushPromises(); + expect(htmlRemoveId(wrapper.html())).toMatchSnapshot(); + wrapper.find("button").trigger("click"); + await wrapper.vm.$nextTick(); + await flushPromises(); + expect(htmlRemoveId(wrapper.html())).toMatchSnapshot(); + expect(requestHandlers.handle_0).toHaveBeenCalledTimes(1); + expect(requestHandlers.handle_1).toHaveBeenCalledTimes(1); + expect(requestHandlers.handle_0).toHaveBeenCalledWith({ + name: "mygroup", + }); + expect(requestHandlers.handle_1).toHaveBeenCalledWith({ + actorId: 123, + groupId: "123", + token: "dhfqjkhesfkhqdkjsqfkjds", + }); + }); +}); diff --git a/tests/unit/specs/views/Group/GroupInvitations.spec.ts b/tests/unit/specs/views/Group/GroupInvitations.spec.ts new file mode 100644 index 000000000..8d205d215 --- /dev/null +++ b/tests/unit/specs/views/Group/GroupInvitations.spec.ts @@ -0,0 +1,135 @@ +import { beforeEach, describe, it, expect } from "vitest"; +import { enUS } from "date-fns/locale"; +import { routes } from "@/router"; +import { createRouter, createWebHistory, Router } from "vue-router"; +import { config, mount } from "@vue/test-utils"; +import { Oruga } from "@oruga-ui/oruga-next"; +import flushPromises from "flush-promises"; +import { getMockClient, requestHandlers } from "../../mocks/client"; +import { htmlRemoveId } from "../../common"; +import GroupInvitations from "@/views/Group/GroupInvitations.vue"; +import { + GROUP_INVITATIONS_LIST, + GROUP_INVITATIONS_DELETE, + GROUP_INVITATIONS_CREATE, + GROUP_INVITATIONS_UPDATE, +} from "@/graphql/invitations"; +import { INVITE_MEMBER } from "@/graphql/member"; +import { FETCH_GROUP_PUBLIC } from "@/graphql/group"; + +config.global.plugins.push(Oruga); + +let router: Router; + +beforeEach(async () => { + router = createRouter({ + history: createWebHistory(), + routes: routes, + }); + + // await router.isReady(); +}); + +const mock_group = { + data: { + group: { + __typename: "Group", + avatar: null, + banner: null, + domain: null, + id: "123", + manuallyApprovesFollowers: true, + allowSeeParticipants: false, + members: { + __typename: "PaginatedMemberList", + total: 1, + }, + name: "ssss", + openness: "MODERATED", + organizedEvents: { + __typename: "PaginatedEventList", + elements: [], + total: 0, + }, + physicalAddress: null, + posts: { + __typename: "PaginatedPostList", + elements: [], + total: 0, + }, + preferredUsername: "example", + summary: null, + suspended: false, + type: "GROUP", + url: "https://mobilizon.test/@example", + visibility: "PUBLIC", + }, + }, +}; + +const generateWrapper = () => { + const global_data = getMockClient([ + [FETCH_GROUP_PUBLIC, mock_group], + GROUP_INVITATIONS_LIST, + GROUP_INVITATIONS_DELETE, + GROUP_INVITATIONS_CREATE, + GROUP_INVITATIONS_UPDATE, + INVITE_MEMBER, + ]); + global_data.provide.dateFnsLocale = enUS; + global_data.plugins = [router]; + return mount(GroupInvitations, { + props: { + preferredUsername: "mygroup", + }, + global: { + ...global_data, + stubs: { + RouterLink: false, + }, + }, + }); +}; + +describe("GroupInvitations", () => { + it("Show simple", async () => { + const wrapper = generateWrapper(); + await wrapper.vm.$nextTick(); + await flushPromises(); + expect(htmlRemoveId(wrapper.html())).toMatchSnapshot(); + expect(requestHandlers.handle_0).toHaveBeenCalledTimes(1); + expect(requestHandlers.handle_1).toHaveBeenCalledTimes(1); + expect(requestHandlers.handle_2).toHaveBeenCalledTimes(0); + expect(requestHandlers.handle_3).toHaveBeenCalledTimes(0); + expect(requestHandlers.handle_4).toHaveBeenCalledTimes(0); + expect(requestHandlers.handle_5).toHaveBeenCalledTimes(0); + expect(requestHandlers.handle_0).toHaveBeenCalledWith({ + name: "mygroup", + }); + expect(requestHandlers.handle_1).toHaveBeenCalledWith({ + groupId: "123", + }); + }); + + it("Invite", async () => { + const wrapper = generateWrapper(); + await wrapper.vm.$nextTick(); + await flushPromises(); + wrapper + .find('input[id="new-member-field"]') + .setValue("invite@mobilizon.test"); + wrapper.find("form").trigger("submit"); + await wrapper.vm.$nextTick(); + await flushPromises(); + expect(requestHandlers.handle_0).toHaveBeenCalledTimes(1); + expect(requestHandlers.handle_1).toHaveBeenCalledTimes(1); + expect(requestHandlers.handle_2).toHaveBeenCalledTimes(0); + expect(requestHandlers.handle_3).toHaveBeenCalledTimes(0); + expect(requestHandlers.handle_4).toHaveBeenCalledTimes(0); + expect(requestHandlers.handle_5).toHaveBeenCalledTimes(1); + expect(requestHandlers.handle_5).toHaveBeenCalledWith({ + groupId: "123", + targetActorUsername: "invite@mobilizon.test", + }); + }); +}); diff --git a/tests/unit/specs/views/Group/GroupMembers.spec.ts b/tests/unit/specs/views/Group/GroupMembers.spec.ts index a7596f422..bd6e08957 100644 --- a/tests/unit/specs/views/Group/GroupMembers.spec.ts +++ b/tests/unit/specs/views/Group/GroupMembers.spec.ts @@ -186,7 +186,7 @@ describe("GroupMembers", () => { const wrapper = generateWrapper(); await wrapper.vm.$nextTick(); await flushPromises(); - wrapper.findAll("button")[1].trigger("click"); + wrapper.findAll("button")[0].trigger("click"); await wrapper.vm.$nextTick(); await flushPromises(); expect(requestHandlers.handle_0).toHaveBeenCalledTimes(0); @@ -205,7 +205,7 @@ describe("GroupMembers", () => { const wrapper = generateWrapper(); await wrapper.vm.$nextTick(); await flushPromises(); - wrapper.findAll("button")[3].trigger("click"); + wrapper.findAll("button")[2].trigger("click"); await wrapper.vm.$nextTick(); await flushPromises(); expect(requestHandlers.handle_0).toHaveBeenCalledTimes(0); @@ -220,7 +220,7 @@ describe("GroupMembers", () => { }); }); - it("Invite", async () => { + /* it("Invite", async () => { const wrapper = generateWrapper(); await wrapper.vm.$nextTick(); await flushPromises(); @@ -239,5 +239,5 @@ describe("GroupMembers", () => { groupId: "6", targetActorUsername: "invite@mobilizon.test", }); - }); + });*/ }); diff --git a/tests/unit/specs/views/Group/__snapshots__/GroupInvitationJoin.spec.ts.snap b/tests/unit/specs/views/Group/__snapshots__/GroupInvitationJoin.spec.ts.snap new file mode 100644 index 000000000..9e96eaef4 --- /dev/null +++ b/tests/unit/specs/views/Group/__snapshots__/GroupInvitationJoin.spec.ts.snap @@ -0,0 +1,35 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`GroupInvitationJoin > Show simple 1`] = ` +"
+
+

Join a group

+
+

Do you want to join the group "mygroup" with the profile "test" ?

+

You can create a new profile or change the actual profile with the top menu.

+
+
+
" +`; + +exports[`GroupInvitationJoin > Show simple 2`] = ` +"
+
+

Join a group

+
+ +
+ +
+
You successfully joined the group "mygroup" with your profile "test".
+
+
+
Go to the group page + + +
+
+
" +`; diff --git a/tests/unit/specs/views/Group/__snapshots__/GroupInvitations.spec.ts.snap b/tests/unit/specs/views/Group/__snapshots__/GroupInvitations.spec.ts.snap new file mode 100644 index 000000000..20d450624 --- /dev/null +++ b/tests/unit/specs/views/Group/__snapshots__/GroupInvitations.spec.ts.snap @@ -0,0 +1,50 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`GroupInvitations > Show simple 1`] = ` +"
+ +
+

Invitations to join the group

+

Member invitation

+
+
+
+
+
+ +
+
+
+ +
+
+
+ + + +
+
+
+ +
+
+
+ +
+
+ +
+
+

Group invitation links

+
+ + +
+ +
+
" +`; diff --git a/tests/unit/specs/views/Group/__snapshots__/GroupMembers.spec.ts.snap b/tests/unit/specs/views/Group/__snapshots__/GroupMembers.spec.ts.snap index 20aefbdb8..14ac076e6 100644 --- a/tests/unit/specs/views/Group/__snapshots__/GroupMembers.spec.ts.snap +++ b/tests/unit/specs/views/Group/__snapshots__/GroupMembers.spec.ts.snap @@ -8,47 +8,13 @@ exports[`GroupMembers > Show simple 1`] = `

Group Members (2)

-
-
-
-
-
- -
-
-
- -
-
-

-

- - - -
-

-

-
-
- -
-
-
- -
-
- -
-
-
+
-