ssb: Test the one message generated from an invite so far.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 26m7s

This commit is contained in:
Cory McWilliams 2025-01-19 18:38:26 -05:00
parent 616f3ad76d
commit 97fc22ce57
2 changed files with 17 additions and 10 deletions

View File

@ -1744,9 +1744,6 @@ static void _tf_ssb_rpc_invite_use(tf_ssb_connection_t* connection, uint8_t flag
tf_ssb_connection_get_id(connection, work->invite_public_key, sizeof(work->invite_public_key));
const char* id = JS_ToCString(context, feed);
snprintf(work->id, sizeof(work->id), "%s", id);
tf_printf("PUB = %s\n", work->pub);
tf_printf("FEED = %s\n", work->id);
tf_printf("INVITE_PUBLIC_KEY = %s\n", work->invite_public_key);
JS_FreeCString(context, id);
JS_FreeValue(context, feed);
JS_FreeValue(context, object);

View File

@ -1350,6 +1350,12 @@ void tf_ssb_test_invite(const tf_test_options_t* options)
tf_ssb_release_db_writer(ssb0, writer);
tf_printf("invite: %s\n", invite);
int count0 = 0;
int count1 = 0;
tf_ssb_add_message_added_callback(ssb0, _message_added, NULL, &count0);
tf_ssb_add_message_added_callback(ssb1, _message_added, NULL, &count1);
tf_ssb_connect_str(ssb1, invite, 0, NULL, NULL);
tf_printf("Waiting for connection.\n");
@ -1362,22 +1368,26 @@ void tf_ssb_test_invite(const tf_test_options_t* options)
tf_ssb_set_main_thread(ssb1, false);
}
tf_ssb_server_close(ssb0);
tf_ssb_send_close(ssb1);
tf_printf("final run\n");
tf_printf("waiting for messages\n");
tf_ssb_set_main_thread(ssb0, true);
tf_ssb_set_main_thread(ssb1, true);
uv_run(&loop, UV_RUN_DEFAULT);
while (count0 != 1 || count1 != 1)
{
uv_run(&loop, UV_RUN_ONCE);
}
tf_ssb_set_main_thread(ssb0, false);
tf_ssb_set_main_thread(ssb1, false);
tf_printf("done\n");
tf_printf("destroy 0\n");
tf_ssb_server_close(ssb0);
tf_ssb_send_close(ssb1);
tf_ssb_destroy(ssb0);
tf_printf("destroy 1\n");
tf_ssb_destroy(ssb1);
tf_printf("final run\n");
uv_run(&loop, UV_RUN_DEFAULT);
tf_printf("close\n");
uv_loop_close(&loop);
}