pleroma/test/pleroma/otp_version_test.exs

43 lines
1.2 KiB
Elixir
Raw Normal View History

2020-03-03 10:19:29 +01:00
# Pleroma: A lightweight social networking server
# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
2020-03-03 10:19:29 +01:00
# SPDX-License-Identifier: AGPL-3.0-only
2020-02-11 08:12:57 +01:00
defmodule Pleroma.OTPVersionTest do
use ExUnit.Case, async: true
alias Pleroma.OTPVersion
2020-03-03 10:19:29 +01:00
describe "check/1" do
2020-02-11 08:12:57 +01:00
test "22.4" do
2020-03-04 07:23:42 +01:00
assert OTPVersion.get_version_from_files(["test/fixtures/warnings/otp_version/22.4"]) ==
"22.4"
2020-02-11 08:12:57 +01:00
end
test "22.1" do
2020-03-04 07:23:42 +01:00
assert OTPVersion.get_version_from_files(["test/fixtures/warnings/otp_version/22.1"]) ==
"22.1"
2020-02-11 08:12:57 +01:00
end
test "21.1" do
2020-03-04 07:23:42 +01:00
assert OTPVersion.get_version_from_files(["test/fixtures/warnings/otp_version/21.1"]) ==
"21.1"
2020-02-11 08:12:57 +01:00
end
test "23.0" do
2020-03-04 07:23:42 +01:00
assert OTPVersion.get_version_from_files(["test/fixtures/warnings/otp_version/23.0"]) ==
"23.0"
2020-02-11 08:12:57 +01:00
end
test "with nonexistent file" do
2020-03-04 07:23:42 +01:00
assert OTPVersion.get_version_from_files([
2020-02-11 08:12:57 +01:00
"test/fixtures/warnings/otp_version/non-exising",
"test/fixtures/warnings/otp_version/22.4"
2020-03-04 07:23:42 +01:00
]) == "22.4"
2020-02-11 08:12:57 +01:00
end
test "empty paths" do
2020-03-04 07:23:42 +01:00
assert OTPVersion.get_version_from_files([]) == nil
2020-02-11 08:12:57 +01:00
end
end
end