1// SPDX-License-Identifier: GPL-2.0-only
2// Copyright (c) 2025-present FERS Contributors (see AUTHORS.md).
4import { describe, expect, it } from 'bun:test';
7 getAntennaPreviewErrorAction,
9 shouldDeferAntennaPreviewFetch,
10} from './AntennaPatternMesh';
12describe('AntennaPatternMesh preview recovery', () => {
13 it('treats backend lock contention as a transient retry condition', () => {
14 const error = new Error(BACKEND_BUSY_MESSAGE);
16 expect(isBackendBusyError(error)).toBe(true);
17 expect(getAntennaPreviewErrorAction(error)).toEqual({
24 it('preserves hard failures as visible preview errors', () => {
25 const error = new Error('antenna pattern file missing');
27 expect(isBackendBusyError(error)).toBe(false);
28 expect(getAntennaPreviewErrorAction(error)).toEqual({
35 it('defers fetches until backend work has finished', () => {
37 shouldDeferAntennaPreviewFetch({
39 isBackendSyncing: true,
41 isGeneratingKml: false,
46 shouldDeferAntennaPreviewFetch({
48 isBackendSyncing: false,
50 isGeneratingKml: false,
55 shouldDeferAntennaPreviewFetch({
57 isBackendSyncing: false,
59 isGeneratingKml: true,
64 shouldDeferAntennaPreviewFetch({
66 isBackendSyncing: false,
68 isGeneratingKml: false,
73 shouldDeferAntennaPreviewFetch({
75 isBackendSyncing: true,
77 isGeneratingKml: true,