@@ -328,7 +328,7 @@ class ManageSuggestions extends Page implements HasTable
|
||||
/**
|
||||
* Polls a sync job's status (wire:poll.2s, see the view). On "finished",
|
||||
* chains a reload-index call — same two-step flow shweai_backend's admin
|
||||
* JS does (POST sync-chroma → poll → POST reload-index) — and refreshes
|
||||
* JS does (POST sync → poll → POST reload-index) — and refreshes
|
||||
* the table. On "failed", notifies and stops polling.
|
||||
*/
|
||||
public function pollSyncStatus(): void
|
||||
|
||||
@@ -122,8 +122,8 @@ test('deleteSelected bulk action calls batchDeleteSuggestions with just the sele
|
||||
|
||||
test('sync sets job state and polling chains a reload-index call on finished', function () {
|
||||
Http::fake(['bnfexpress.test/*' => fn (Request $request) => match (true) {
|
||||
str_contains($request->url(), '/sync-chroma/job-1') => Http::response(['status' => 'finished', 'result' => ['synced' => 3]]),
|
||||
str_contains($request->url(), '/sync-chroma') => Http::response(['job_id' => 'job-1'], 202),
|
||||
str_contains($request->url(), '/sync/job-1') => Http::response(['status' => 'finished', 'result' => ['synced' => 3]]),
|
||||
str_contains($request->url(), '/sync') => Http::response(['job_id' => 'job-1'], 202),
|
||||
str_contains($request->url(), '/reload-index') => Http::response(['trie_rebuilt' => true]),
|
||||
default => Http::response([]),
|
||||
}]);
|
||||
@@ -144,8 +144,8 @@ test('sync sets job state and polling chains a reload-index call on finished', f
|
||||
|
||||
test('a failed sync job notifies danger and stops polling', function () {
|
||||
Http::fake(['bnfexpress.test/*' => fn (Request $request) => match (true) {
|
||||
str_contains($request->url(), '/sync-chroma/job-1') => Http::response(['status' => 'failed', 'result' => null]),
|
||||
str_contains($request->url(), '/sync-chroma') => Http::response(['job_id' => 'job-1'], 202),
|
||||
str_contains($request->url(), '/sync/job-1') => Http::response(['status' => 'failed', 'result' => null]),
|
||||
str_contains($request->url(), '/sync') => Http::response(['job_id' => 'job-1'], 202),
|
||||
default => Http::response([]),
|
||||
}]);
|
||||
|
||||
@@ -182,6 +182,6 @@ test('syncEmbedding and deleteEmbedding row actions call the right per-id endpoi
|
||||
$test->callTableAction('syncEmbedding', 1)->assertNotified('Embedding synced');
|
||||
$test->callTableAction('deleteEmbedding', 1)->assertNotified('Embedding deleted');
|
||||
|
||||
Http::assertSent(fn (Request $request) => str_contains($request->url(), '/admin/suggestions/1/sync-chroma') && $request->method() === 'POST');
|
||||
Http::assertSent(fn (Request $request) => str_contains($request->url(), '/admin/suggestions/1/chroma') && $request->method() === 'DELETE');
|
||||
Http::assertSent(fn (Request $request) => str_contains($request->url(), '/admin/suggestions/1/sync') && $request->method() === 'POST');
|
||||
Http::assertSent(fn (Request $request) => str_contains($request->url(), '/admin/suggestions/1/embedding') && $request->method() === 'DELETE');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user