From 6779ef3ece0c9a99c1a347f22153d9547e2ac033 Mon Sep 17 00:00:00 2001 From: Gonzalo <456459+grzuy@users.noreply.github.com> Date: Mon, 5 Feb 2024 16:23:21 -0300 Subject: [PATCH] test: some test coverage (#3) * test: adds test coverage to Juggler.init * ci: enables mix test * build(deps): support elixir 1.15 * test description --- .github/workflows/ci.yml | 3 +-- mix.exs | 2 +- test/juggler_test.exs | 19 +++++++++++++++++-- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 41a3287..779e21d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,5 +29,4 @@ jobs: - run: mix deps.compile - run: mix compile --warnings-as-errors if: ${{ matrix.lint }} - # TODO - # - run: mix test + - run: mix test diff --git a/mix.exs b/mix.exs index 90eb48a..578e5bf 100644 --- a/mix.exs +++ b/mix.exs @@ -5,7 +5,7 @@ defmodule Juggler.MixProject do [ app: :juggler, version: "0.1.0", - elixir: "~> 1.16", + elixir: "~> 1.15", start_permanent: Mix.env() == :prod, deps: deps() ] diff --git a/test/juggler_test.exs b/test/juggler_test.exs index 1b718e6..838894d 100644 --- a/test/juggler_test.exs +++ b/test/juggler_test.exs @@ -2,7 +2,22 @@ defmodule JugglerTest do use ExUnit.Case doctest Juggler - test "greets the world" do - assert Juggler.hello() == :world + @tmp_path Path.expand("../tmp", __DIR__) + + setup do + File.mkdir_p!(@tmp_path) + on_exit(fn -> File.rm_rf(@tmp_path) end) + :ok + end + + test "init/0 generates juggles file" do + File.cd!( + @tmp_path, + fn -> + refute File.exists?("juggles.exs") + assert Juggler.init() == :ok + assert File.exists?("juggles.exs") + end + ) end end