Skip to content

Commit 7310563

Browse files
committed
pass test for coverage posting
1 parent 57d04d6 commit 7310563

5 files changed

Lines changed: 19 additions & 13 deletions

File tree

.github/dependabot.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,9 @@ updates:
1212
labels:
1313
- "hex"
1414
- "dependencies"
15+
version: 2
16+
updates:
17+
- package-ecosystem: "github-actions"
18+
directory: "/"
19+
schedule:
20+
interval: "daily"

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22

33
Restful client for Typesense with adherence to Open API spec 3 (formerly Swagger)
44

5+
[![Dependabot](https://img.shields.io/badge/Dependabot-enabled-green)](https://github.com/jaeyson/open_api_typesense/pulls/app%2Fdependabot)
56
[![Hex.pm](https://img.shields.io/hexpm/v/open_api_typesense)](https://hex.pm/packages/open_api_typesense)
67
[![Hexdocs.pm](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/open_api_typesense)
78
[![Hex.pm](https://img.shields.io/hexpm/l/open_api_typesense)](https://hexdocs.pm/open_api_typesense/license.html)
89
[![Typesense badge](https://img.shields.io/badge/Typesense-v27.1-darkblue)](https://typesense.org/docs/27.1/api)
910
[![Coverage Status](https://coveralls.io/repos/github/jaeyson/open_api_typesense/badge.svg?branch=main)](https://coveralls.io/github/jaeyson/open_api_typesense?branch=main)
11+
[![CI Status](https://github.com/jaeyson/open_api_typesense/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/jaeyson/open_api_typesense/actions/workflows/ci.yml)
1012

1113
## TODO
1214
- Custom Http client adapter (currently [`Req`](https://hexdocs.pm/req))

lib/open_api_typesense/client.ex

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ defmodule OpenApiTypesense.Client do
4646
4747
> #### On using this function {: .info}
4848
> Functions e.g. `OpenApiTypesense.Health.health` don't need to explicitly pass
49-
> a `connection` unless you want to use custom `connection`. See [`README`](/README.md) for
50-
> more details or `OpenApiTypesense.Connection` module.
49+
> a `connection` unless you want to use custom `connection`. See [`README`](/README.md) for more details or `OpenApiTypesense.Connection` module.
5150
5251
## Options
5352

lib/open_api_typesense/connection.ex

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,17 @@ defmodule OpenApiTypesense.Connection do
2727
## Examples
2828
2929
iex> alias OpenApiTypesense.Connection
30-
31-
iex> conn = Connection.new()
30+
...> Connection.new()
3231
%OpenApiTypesense.Connection{
3332
host: "localhost",
3433
port: 8108,
3534
scheme: "http",
36-
...
35+
api_key: "xyz"
3736
}
3837
39-
iex> Connection.new(%{})
40-
** (ArgumentError) Missing required fields: [:port, :scheme, :host, :api_key]
41-
(open_api_typesense 0.2.0) lib/open_api_typesense/connection.ex:56: OpenApiTypesense.Connection.new/1
42-
iex:2: (file)
38+
iex> alias OpenApiTypesense.Connection
39+
...> Connection.new(%{})
40+
** (ArgumentError) Missing required fields: [:api_key, :host, :port, :scheme]
4341
4442
"""
4543
@doc since: "0.2.0"
@@ -48,7 +46,7 @@ defmodule OpenApiTypesense.Connection do
4846
def new(connection \\ defaults())
4947

5048
def new(connection) when is_map(connection) do
51-
missing_fields = required_fields() -- Map.keys(connection)
49+
missing_fields = Enum.sort(required_fields() -- Map.keys(connection))
5250

5351
if missing_fields == [] do
5452
struct(__MODULE__, connection)
@@ -61,7 +59,7 @@ defmodule OpenApiTypesense.Connection do
6159
raise ArgumentError, "Expected a map for connection options"
6260
end
6361

64-
@spec required_fields :: map()
62+
@spec required_fields :: list(atom())
6563
defp required_fields do
6664
struct(__MODULE__, %{}) |> Map.drop([:__struct__]) |> Map.keys()
6765
end

test/open_api_typesense_connection_test.exs renamed to test/connection_test.exs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
defmodule OpenApiTypesense.ConnectionTest do
1+
defmodule ConnectionTest do
22
use ExUnit.Case, async: true
3+
doctest OpenApiTypesense.Connection
34

45
alias OpenApiTypesense.Connection
56

@@ -32,7 +33,7 @@ defmodule OpenApiTypesense.ConnectionTest do
3233
end
3334

3435
test "new/1 with empty map raises ArgumentError" do
35-
msg = "Missing required fields: [:port, :scheme, :host, :api_key]"
36+
msg = "Missing required fields: [:api_key, :host, :port, :scheme]"
3637
assert_raise ArgumentError, msg, fn -> Connection.new(%{}) end
3738
end
3839

0 commit comments

Comments
 (0)