Rewrite and expand EUnit suite; run unit tests in CI from shared test image. Refs EventHub/EventHubBack#36 [skip ci]

This commit is contained in:
2026-07-17 15:16:46 +03:00
parent 9d2780fef4
commit 4fa802702f
54 changed files with 4240 additions and 2281 deletions
+8 -11
View File
@@ -2,19 +2,17 @@
-include_lib("eunit/include/eunit.hrl").
-include("records.hrl").
-define(TABLES, [booking, calendar, event]).
setup() ->
pg:start_link(),
mnesia:start(),
mnesia:create_table(booking, [{attributes, record_info(fields, booking)}, {ram_copies, [node()]}]),
mnesia:create_table(calendar, [{attributes, record_info(fields, calendar)}, {ram_copies, [node()]}]),
mnesia:create_table(event, [{attributes, record_info(fields, event)}, {ram_copies, [node()]}]),
eh_test_support:start_mnesia(),
eh_test_support:ensure_tables(?TABLES),
ok.
cleanup(_) ->
mnesia:delete_table(event),
mnesia:delete_table(calendar),
mnesia:delete_table(booking),
mnesia:stop(),
eh_test_support:delete_tables(?TABLES),
eh_test_support:stop_mnesia(),
ok.
logic_notification_test_() ->
@@ -66,7 +64,7 @@ create_test_event() ->
title = <<"Test Event">>,
description = <<"">>,
event_type = single,
start_time = {{2026, 6, 1}, {10, 0, 0}},
start_time = eh_test_support:future_start(),
duration = 60,
recurrence_rule = undefined,
master_id = undefined,
@@ -89,7 +87,6 @@ test_notify_booking() ->
Booking = create_test_booking(),
UserId = <<"user123">>,
% Функция возвращает список пидов (может быть пустым)
Result = logic_notification:notify_booking(UserId, Booking),
?assert(is_list(Result)).
@@ -105,4 +102,4 @@ test_notify_event_update() ->
test_notify_admin() ->
Result = logic_notification:notify_admin(report_created, #{report_id => <<"rep123">>}),
?assertEqual(ok, Result).
?assertEqual(ok, Result).