Skip to content

Commit

Permalink
Update endpoint_test.exs
Browse files Browse the repository at this point in the history
  • Loading branch information
bpaquet committed Jul 24, 2024
1 parent ab60521 commit 1c5fff7
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions neurow/test/neurow/internal_api/endpoint_test.exs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
defmodule Neurow.InternalApi.EndpointTest do
use ExUnit.Case, async: true
use ExUnit.Case
use Plug.Test

alias Neurow.InternalApi.Message
Expand Down Expand Up @@ -99,9 +99,10 @@ defmodule Neurow.InternalApi.EndpointTest do
conn(:post, "/v1/publish", body) |> put_jwt_token_in_req_header_internal_api()

call = Neurow.InternalApi.Endpoint.call(conn, [])

assert call.status == 200

Process.sleep(20)

assert_received {:pubsub_message,
%Message{
type: "type_foo",
Expand All @@ -124,9 +125,10 @@ defmodule Neurow.InternalApi.EndpointTest do
conn(:post, "/v1/publish", body) |> put_jwt_token_in_req_header_internal_api()

call = Neurow.InternalApi.Endpoint.call(conn, [])

assert call.status == 200

Process.sleep(20)

assert_received {:pubsub_message,
%Message{
type: "type_foo",
Expand Down Expand Up @@ -158,6 +160,9 @@ defmodule Neurow.InternalApi.EndpointTest do
conn(:post, "/v1/publish", body) |> put_jwt_token_in_req_header_internal_api()

call = Neurow.InternalApi.Endpoint.call(conn, [])
assert call.status == 200

Process.sleep(20)

assert_received(
{:pubsub_message,
Expand All @@ -176,8 +181,6 @@ defmodule Neurow.InternalApi.EndpointTest do
timestamp: 123_458
}}
)

assert call.status == 200
end

test "provides a timestamp if the message timestamp is not provided in the request payload" do
Expand Down

0 comments on commit 1c5fff7

Please sign in to comment.