(api: BytebaseApiClient)
| 27 | * allowJustInTimeAccess) — those are SUT for individual specs. |
| 28 | */ |
| 29 | export async function seedTestData(api: BytebaseApiClient): Promise<void> { |
| 30 | try { |
| 31 | await api.setWorkspaceExternalUrl(TEST_EXTERNAL_URL); |
| 32 | } catch (err) { |
| 33 | // The setting may not exist yet on a fresh server; updateMask |
| 34 | // semantics + allowMissing on the gateway should make PATCH a |
| 35 | // create-or-update. Surface the error so a test infra change |
| 36 | // doesn't silently drop the banner-suppression. |
| 37 | throw new Error( |
| 38 | `seedTestData: failed to set external URL — ${err instanceof Error ? err.message : err}`, |
| 39 | ); |
| 40 | } |
| 41 | |
| 42 | // Enterprise license auto-activates a built-in workspace approval |
| 43 | // "Fallback Rule" (Moderate · Requires project owner approval when |
| 44 | // no other rules match) that fires for every CHANGE_DATABASE plan. |
| 45 | // Without it, requireIssueApproval=false projects auto-create the |
| 46 | // rollout — that's the baseline tests assume. Free plan has no rule |
| 47 | // at all, so clearing here is a no-op there but makes the licensed |
| 48 | // baseline match the free-plan one. Tests that DO want approval set |
| 49 | // their own rule in beforeAll and restore on afterAll. |
| 50 | try { |
| 51 | await api.upsertSetting( |
| 52 | "WORKSPACE_APPROVAL", |
| 53 | { workspaceApproval: { rules: [] } }, |
| 54 | "value.workspace_approval", |
| 55 | ); |
| 56 | } catch { |
| 57 | // Free plan: setting won't accept rules without license; rules |
| 58 | // would already be empty on that path. Swallow silently. |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | // Re-exported identifiers used by tests that need their own additional |
| 63 | // project. Created on-demand by `ensureSecondaryProject()` — kept here |
no test coverage detected