1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Docs.Translator.CompilerTest do
6 use ExUnit.Case, async: true
8 alias Pleroma.Docs.Translator.Compiler
41 %{key: "11", description: "11"},
62 group: {":subgroup", "16"},
67 describe "extract_strings/1" do
68 test "it extracts all labels and descriptions" do
69 strings = Compiler.extract_strings(@descriptions)
70 assert length(strings) == 16
72 assert {["1"], "label", "1"} in strings
73 assert {["1"], "description", "2"} in strings
74 assert {["1", "3"], "label", "3"} in strings
75 assert {["1", "3"], "description", "4"} in strings
76 assert {["1", "5"], "label", "5"} in strings
77 assert {["1", "5"], "description", "6"} in strings
78 assert {["7"], "label", "7"} in strings
79 assert {["7"], "description", "8"} in strings
80 assert {["7", "9"], "description", "9"} in strings
81 assert {["7", "9", "10"], "description", "10"} in strings
82 assert {["7", "9", "10", "11"], "description", "11"} in strings
83 assert {["7", "9", "10", nil], "description", "12"} in strings
84 assert {["7", nil], "label", "13"} in strings
85 assert {["14"], "label", "14"} in strings
86 assert {["15-15"], "label", "15"} in strings
87 assert {["16"], "label", "16"} in strings