-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: osi list shows officials' name with email as fallback
- Loading branch information
Showing
6 changed files
with
65 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ jest.mock("../../../hooks/useSignIns", () => ({ | |
signed_in_at: DateTime.fromISO("2024-07-22T12:45:52.000-04:00", { | ||
zone: "America/New_York", | ||
}), | ||
signed_in_by_user: "[email protected]", | ||
signed_in_by: "[email protected]", | ||
signed_in_employee: EMPLOYEES[0].badge, | ||
}, | ||
], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ const TEST_DATA = { | |
{ | ||
rail_line: "blue", | ||
signed_in_at: "2024-07-22T16:42:32Z", | ||
signed_in_by_user: "[email protected]", | ||
signed_in_by: "[email protected]", | ||
signed_in_employee: "123", | ||
}, | ||
], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ defmodule OrbitWeb.SignInControllerTest do | |
%{ | ||
"rail_line" => "blue", | ||
"signed_in_at" => _date, | ||
"signed_in_by_user" => _user, | ||
"signed_in_by" => _user, | ||
"signed_in_employee" => _badge | ||
} | ||
] | ||
|
@@ -64,6 +64,47 @@ defmodule OrbitWeb.SignInControllerTest do | |
} = json_response(conn, 200) | ||
end | ||
|
||
@tag :authenticated | ||
test "shows officials' names if available", %{conn: conn} do | ||
insert(:employee, email: "[email protected]") | ||
|
||
insert(:operator_sign_in, | ||
signed_in_at: DateTime.new!(~D[2024-07-21], ~T[12:00:00], @timezone), | ||
signed_in_by_user: build(:user, email: "[email protected]") | ||
) | ||
|
||
conn = get(conn, ~p"/api/signin", %{"line" => "blue", "service_date" => "2024-07-21"}) | ||
|
||
assert %{ | ||
"data" => [ | ||
%{ | ||
"signed_in_by" => "Preferredy Person" | ||
} | ||
] | ||
} = json_response(conn, 200) | ||
end | ||
|
||
@tag :authenticated | ||
test "shows official's email address if name is unavailable", %{conn: conn} do | ||
insert(:operator_sign_in, | ||
signed_in_at: DateTime.new!(~D[2024-07-21], ~T[12:00:00], @timezone), | ||
signed_in_by_user: | ||
build(:user, %{ | ||
email: "[email protected]" | ||
}) | ||
) | ||
|
||
conn = get(conn, ~p"/api/signin", %{"line" => "blue", "service_date" => "2024-07-21"}) | ||
|
||
assert %{ | ||
"data" => [ | ||
%{ | ||
"signed_in_by" => "[email protected]" | ||
} | ||
] | ||
} = json_response(conn, 200) | ||
end | ||
|
||
@tag :authenticated | ||
test "sorted by signed_in_at descending (recent first)", %{conn: conn} do | ||
insert(:operator_sign_in, | ||
|