summaryrefslogtreecommitdiff
path: root/frontend/src/lib/wizardError.test.ts
blob: 43a6bb039b1112bbb20e0466b82f6d3c2dffe3bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { describe, expect, it } from 'vitest';
// Live browser QA regression: a failing dataset submit (e.g. HTTP422/500 from
// the backend) was captured into `submitErr` but never rendered, so the user
// saw silently nothing. The wizard markup must surface submitErr.
// Type support comes from vite/client's `*?raw` module declaration.
import wizardSource from '../components/DatasetWizard.svelte?raw';

describe('dataset wizard visible submit errors', () => {
  it('renders backend submit failures (submitErr in template, not script-only)', () => {
    const src: string = wizardSource as unknown as string;
    // captured at least once
    expect(src).toMatch(/submitErr = extractStatusMessage\(e\)/);
    // and rendered outside the script: a template reference (Svelte template)
    const template = src.slice(src.indexOf('/script') + 7);
    expect(template).toMatch(/\{submitErr\}/);
    expect(template).toMatch(/role="alert"/);
  });
});