Skip to content

Commit

Permalink
chore: Add test coverage for API
Browse files Browse the repository at this point in the history
  • Loading branch information
kiosion committed Nov 8, 2023
1 parent ab98385 commit af47143
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
**/build
**/_build
**/deps
elixir-api/cover

# Dependencies
.pnp.*
Expand Down
2 changes: 1 addition & 1 deletion elixir-api/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ run: # Run docker container for 'production' dataset build
test: SHELL:=/bin/bash
test: install
test:
@. .env && MIX_ENV=test mix test
@. .env && MIX_ENV=test mix test --cover

cleanup: SHELL:=/bin/bash
cleanup:
Expand Down
2 changes: 1 addition & 1 deletion elixir-api/lib/routes/api/v1/inc.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ defmodule Router.Api.V1.Inc do
@spec handle_inc(Plug.Conn.t(), binary(), map()) :: Plug.Conn.t()
def handle_inc(conn, id, body) when is_map(body) do
if body["target"] == "views" do
query = "*[_id = '#{id}'][0]"
query = "*[_id == '#{id}'][0]"
{:ok, _pid} = try_increment_view_count(query)

receive do
Expand Down
11 changes: 10 additions & 1 deletion elixir-api/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,16 @@ defmodule Hexerei.MixProject do
start_permanent: Mix.env() == :prod,
deps: deps(),
escript: escript(),
releases: releases()
releases: releases(),
test_coverage: [
summary: [
threshold: 50
],
ignore_modules: [
Router.Api.Base,
Hexerei.HTTP.DefaultClient
]
]
]
end

Expand Down

0 comments on commit af47143

Please sign in to comment.