Skip to content

Commit 15dbc19

Browse files
committed
test: fix all compile warnings in test/
Three categories of warnings fixed: 1. Unused variable: rename authorize_url to _authorize_url in the callback-receive block (the value is only used to consume the message from the test mailbox). 2. Deprecated map.field() with parentheses: save_token_for_test/2 used token.access_token() etc. to read a map field, which the compiler now warns about (must drop the parens). 3. @deprecated function calls: enable_alert/2, disable_alert/2, and trading_days/4 are all marked @deprecated in lib/, so the tests that exercised them emitted a deprecation warning at compile time. Deleted those three describe blocks. Test deletions (AGENTS.md notes this requires justification in the commit body): the deleted tests exist only to exercise functions the library has explicitly marked @deprecated. They provide no coverage of the new APIs (which have their own tests elsewhere) and will need to be removed anyway when the deprecated functions are dropped upstream. Keeping them solely to dodge a compile warning would also require either deleting the test (lossy) or wrapping calls in apply/3 (ugly, hides intent). Per user request, deletion was the chosen path.
1 parent 03418bb commit 15dbc19

3 files changed

Lines changed: 5 additions & 50 deletions

File tree

test/longbridge/alert_context_test.exs

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -230,44 +230,6 @@ defmodule Longbridge.AlertContextTest do
230230
end
231231
end
232232

233-
describe "enable_alert/2 (deprecated)" do
234-
test "POSTs enable: true with the alert_id" do
235-
server =
236-
start_fake_http_server(fn request, socket ->
237-
{method, path, body} = parse_request(request)
238-
assert method == "POST"
239-
assert path == "/v1/notify/reminders"
240-
decoded = JSON.decode!(body)
241-
assert decoded["alert_id"] == "alert-1"
242-
assert decoded["enable"] == true
243-
244-
:gen_tcp.send(socket, http_ok(JSON.encode!(%{"code" => 0, "data" => %{}})))
245-
end)
246-
247-
assert {:ok, _} = AlertContext.enable_alert(config_with(server.port), "alert-1")
248-
stop_fake_http_server(server)
249-
end
250-
end
251-
252-
describe "disable_alert/2 (deprecated)" do
253-
test "POSTs enable: false with the alert_id" do
254-
server =
255-
start_fake_http_server(fn request, socket ->
256-
{method, path, body} = parse_request(request)
257-
assert method == "POST"
258-
assert path == "/v1/notify/reminders"
259-
decoded = JSON.decode!(body)
260-
assert decoded["alert_id"] == "alert-2"
261-
assert decoded["enable"] == false
262-
263-
:gen_tcp.send(socket, http_ok(JSON.encode!(%{"code" => 0, "data" => %{}})))
264-
end)
265-
266-
assert {:ok, _} = AlertContext.disable_alert(config_with(server.port), "alert-2")
267-
stop_fake_http_server(server)
268-
end
269-
end
270-
271233
describe "http_url per-call override" do
272234
test "list_alerts/2 hits the URL passed in opts" do
273235
server =

test/longbridge/market_context_test.exs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -246,13 +246,6 @@ defmodule Longbridge.MarketContextTest do
246246
end
247247
end
248248

249-
describe "trading_days/4" do
250-
test "returns :removed_upstream" do
251-
assert {:error, :removed_upstream} =
252-
MarketContext.trading_days(config_with(0), "2024-01-01", "2024-12-31", "US")
253-
end
254-
end
255-
256249
describe "top_movers/2" do
257250
test "POSTs with encoded sort atom" do
258251
server =

test/longbridge/oauth_test.exs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -425,10 +425,10 @@ defmodule Longbridge.OAuthTest do
425425

426426
json =
427427
JSON.encode!(%{
428-
access_token: token.access_token(),
429-
refresh_token: token.refresh_token(),
430-
expires_at: token.expires_at(),
431-
token_type: token.token_type(),
428+
access_token: token.access_token,
429+
refresh_token: token.refresh_token,
430+
expires_at: token.expires_at,
431+
token_type: token.token_type,
432432
http_url: token[:http_url]
433433
})
434434

@@ -852,7 +852,7 @@ defmodule Longbridge.OAuthTest do
852852
)
853853
end)
854854

855-
authorize_url =
855+
_authorize_url =
856856
receive do
857857
{:authorize_url, url} -> url
858858
after

0 commit comments

Comments
 (0)