All files / msw / handlers config-schemas.ts

100% Statements 3/3
100% Branches 0/0
100% Functions 1/1
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87            149x                                                                                                                                               149x 19x              
import { http, HttpResponse } from 'msw'
 
// Faithful mirror of the API's embedded pipeline config JSON Schema
// (api/internal/schemas/pipeline_config.json, served at
// GET /api/v1/config-schemas/pipeline): identical key structure
// (root/vikunja/lanes), required start, positive-integer minimums, strict
// additionalProperties. Descriptions are concise copies of the schema text.
export const mockPipelineConfigSchema = {
  $schema: 'http://json-schema.org/draft-07/schema#',
  $id: 'pipeline-config',
  version: 1,
  title: 'Pipeline config',
  description: 'Pipeline config schema (JSONB storage, ADR-0007): every key is declared by a feature schema and validated by the API.',
  type: 'object',
  additionalProperties: false,
  properties: {
    vikunja: {
      type: 'object',
      additionalProperties: false,
      description: 'Vikunja integration configuration. Key set: vikunja.lanes.',
      properties: {
        lanes: {
          type: 'object',
          additionalProperties: false,
          description: 'Lane mapping: trigger lanes and optional target lanes as Vikunja bucket ids.',
          required: ['start'],
          properties: {
            start: {
              type: 'array',
              items: { type: 'integer', minimum: 1 },
              minItems: 1,
              uniqueItems: true,
              description: 'Required trigger lane set: at least one positive bucket id.',
            },
            open_questions: {
              type: 'integer',
              minimum: 1,
              description: 'Optional target lane for open questions (bucket id).',
            },
            blocked: {
              type: 'integer',
              minimum: 1,
              description: 'Optional target lane for blocked tickets (bucket id).',
            },
            in_progress: {
              type: 'integer',
              minimum: 1,
              description: 'Optional target lane for running runs (bucket id).',
            },
            pr_open: {
              type: 'integer',
              minimum: 1,
              description: 'Optional target lane for open PRs (bucket id).',
            },
            needs_rework: {
              type: 'integer',
              minimum: 1,
              description: 'Optional target lane for rework tickets (bucket id).',
            },
            done: {
              type: 'integer',
              minimum: 1,
              description: 'Optional target lane for finished tickets (bucket id).',
            },
            pr_rejected: {
              type: 'integer',
              minimum: 1,
              description: 'Optional target lane for rejected PRs (bucket id).',
            },
            failed: {
              type: 'integer',
              minimum: 1,
              description: 'Optional target lane for failed runs (bucket id).',
            },
          },
        },
      },
    },
  },
}
 
export const configSchemaHandlers = [
  http.get('/api/v1/config-schemas/pipeline', () => {
    return HttpResponse.json(mockPipelineConfigSchema)
  }),
]